Results for “module”

Showing 21–30 of 30

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

  2. Challenge

    Shift rota

    Build the station's weekly shift rota: three shifts a day, the crew taken in turn so nobody works two shifts in a row, with a check that proves it, then plan around days off while keeping the work…

    Write the code Hard 2 stages project scheduling lists tuples
  3. Challenge

    Duration formatter

    Split 100,000 seconds of mission time into hours, minutes and seconds with // and %, pad it to a 27:46:40 clock, then add days in the DDD/HH:MM:SS format.

    Write the code Easy 3 stages floor division modulo // %
  4. Challenge

    Packing crates

    Work out how many 12-slot crates 100 sample tubes fill with // and %, then how many crates they need and how full the last one is, including the case where the tubes fit exactly.

    Write the code Medium 2 stages floor division modulo rounding up //
  5. 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…

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