# assignments.all()
Assignments
Every practice challenge across the twelve modules. Click through to attempt in the live editor.
// CHALLENGE_1
Welcome to your first Python coding challenge! Your goal is to write a script that outputs two friendly welcome lines.
Steps to Complete:
- Use a
print()statement to outputHello, World!on the first line. - Use a second
print()statement to outputWelcome to Python Programming!on the second line.
Input: None
Expected Output:
TEXT- Use a
// CHALLENGE_2
Let's build a 3-line welcome banner that calculates hours automatically!
Steps to Complete:
- Print
Python Studio v1.0on line 1. - Print
Total Modules: 12on line 2. - Print
Estimated Hours: 9on line 3, calculating the number 9 using integer division math directly inside yourprint()statement:12 * 45 // 60.
Input: None
Expected Output:
TEXT- Print
// CHALLENGE_3
Let's create a deployment status card for a server service!
Steps to Complete:
- Create variables
nodes = 4andlimit = 100. - Print
Service: Auth-Serviceon line 1. - Print
Active Nodes: 4on line 2. - Print
Total Capacity: 400on line 3, calculating 400 by multiplyingnodes * limitinside yourprint()statement.
Input: None
Expected Output:
TEXT- Create variables
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_4
// CHALLENGE_5
// CHALLENGE_6
// CHALLENGE_7
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_4
// CHALLENGE_5
// CHALLENGE_6
// CHALLENGE_7
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_4
// CHALLENGE_5
// CHALLENGE_6
// CHALLENGE_7
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_4
// CHALLENGE_5
// CHALLENGE_6
// CHALLENGE_7
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_4
// CHALLENGE_5
// CHALLENGE_6
// CHALLENGE_7
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_4
// CHALLENGE_5
// CHALLENGE_6
// CHALLENGE_7
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_4
// CHALLENGE_5
// CHALLENGE_6
// CHALLENGE_7
Stretch Challenge: Explain Inheritance & Polymorphism with Employee hierarchy.
Steps:
- Print explanation:
Inheritance reuses parent code; polymorphism allows uniform method calls.. Workerwithwork(self)returningWorking....Developer(Worker)overridingwork(self)returningWriting Code....- Loop
[Worker(), Developer()]printing output.
- Print explanation:
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
Let's create and catch a custom security exception!
Steps to Complete:
- Define class
InvalidTokenError(Exception). - Write
verify_token(token)raisingInvalidTokenError('Token expired')iftoken != 'VALID_SECRET'. - Call
verify_token('EXPIRED_XYZ')insidetry / exceptand printCaught: Token expired.
Input:
token = 'EXPIRED_XYZ'Expected Output:
TEXT- Define class
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_1
Let's refactor calculations into a modular function pipeline!
Steps to Complete:
- Write
validate_input(val)returningTrueifval > 0. - Write
calculate_tax(val)returningval * 0.10. - Write
process_order(val)callingvalidate_inputand returningcalculate_tax. - Call
process_order(100)and printTax: 10.0.
Expected Output:
TEXT- Write
// CHALLENGE_2
// CHALLENGE_3
// CHALLENGE_1
// CHALLENGE_2
// CHALLENGE_3
Let me help you extract email addresses from text using regular expressions!
Steps to Complete:
- Given
text = 'Contact support@domain.com or admin@server.org for help'. - Use
re.findall()with regex patternr'[w.-]+@[w.-]+.[a-zA-Z]+'. - Print
Emails Found: ['support@domain.com', 'admin@server.org'].
Expected Output:
TEXT- Given
// CHALLENGE_1
Let's merge two JSON data strings into one object!
Steps to Complete:
- Given
json1 = '{"a": 10, "b": 20}'andjson2 = '{"b": 30, "c": 40}'. - Parse both into dicts using
json.loads(), merge dicts (json2updatesjson1). - Serialize merged dict back to JSON text with
json.dumps()and printMerged JSON: {"a": 10, "b": 30, "c": 40}.
Expected Output:
TEXT- Given
// CHALLENGE_2
// CHALLENGE_3
Let's convert raw CSV records into a typed JSON array!
Steps to Complete:
- Given `csv_text = 'id,active
1,true 2,false'`.
- Parse rows with
csv.DictReader, convertingidto int andactiveto boolean. - Dump to JSON string and print
JSON Output: [{"id": 1, "active": true}, {"id": 2, "active": false}].
Expected Output:
TEXT