Challenge
Names that explain
Somebody wrote a quick calculation for the cargo module and called the variables a , b , x2 and tmp . The program works, but nobody, including its author a month from now, can tell what it calculates…
Showing 21–30 of 30
Challenge
Somebody wrote a quick calculation for the cargo module and called the variables a , b , x2 and tmp . The program works, but nobody, including its author a month from now, can tell what it calculates…
Challenge
…version. Ask Python for it with the platform and sys modules and print it the way python --version does.
Article Python Fundamentals
…sensor", "Wheel drive", "Robotic arm", "Soil analysis module" ] print("=== STARTING SECTOR SCAN ===\n") # First loop: scan the map for scan_y in range(10): for scan_x in range(10): # Second loop…
Challenge
…in order. A new field The manifest now also records the module each item is stowed in. The starter code stops with ValueError: too many values to unpack , because the tuple has four values and only…
Article Mini projects
…random secret # In production: use hardware security module or secure key storage secret = os.urandom(32) print("Warning: Using randomly generated secret. Set MEDICATION_DISPENSER_SECRET environment…
Challenge
Give send_command(cmd, retries=3, timeout=5.0) default values so callers only pass what differs, call it three different ways, then add a new priority parameter without breaking any existing call.
Example
For loop iterates through sequence elements. Basic iteration over lists.
Article Python Fundamentals
…print(f"Travel time: {time} hours") Integer Division and Modulus Python provides two types of division: # Regular division (returns float) mission_hours = 100 days = mission_hours / 24 print(f"Mission…
Article Python Fundamentals
…Help on function weight_on_planet in module __main__: weight_on_planet(earth_weight, gravity=0.38) Return what something would weigh on another planet. gravity is the planet's surface gravity compared…
Challenge
…a launch and it answers with JSON, which Python's json module turns into a dict in one line. The mission planners' dashboard only needs three of its fields. Read those fields, then look at everything…