Results for “modulo”

Showing 21–30 of 30

  1. 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…

    Fix the code Easy 3 stages variable names refactoring readability clean code
  2. Article Python Fundamentals

    Nested Loops in Python

    …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…

  3. Challenge

    Manifest line

    …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…

    Write the code Easy 2 stages tuples unpacking ValueError formatting
  4. Article Mini projects

    Medical dispenser - Don’t trust the user

    …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…

  5. Article Python Fundamentals

    Numbers and Basic Math Operations in Python

    …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…

  6. Article Python Fundamentals

    Python Functions for Beginners

    …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…

  7. Challenge

    API response

    …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…

    Write the code Easy 2 stages dictionaries keys items JSON