Results for “print function”

Showing 61–70 of 79

  1. Challenge

    Live T-minus

    …before launch, and at launch itself, and T+ after it, then print countdown(launch, datetime.now(timezone.utc)) . With the clock stopped five minutes after launch, the check expects: T+00:05:00 Pick…

    Write the code Medium 2 stages datetime datetime.now timezone countdown
  2. Challenge

    Unit converter

    Write convert(), which looks a unit pair up in a table of factors, works the other way round by dividing, and refuses unknown units or missing pairs with a clear ValueError, then extend the table with…

    Write the code Medium 2 stages project dictionaries tuples as keys functions
  3. Article Mini projects

    Base 6 Number System in Python

    …how to do it. Converting Decimal to Base 6 - Your Own Function The algorithm is straightforward: keep dividing the decimal number by 6 and collect the remainders. Those remainders, read in reverse…

  4. Article Mini projects

    Python Random Module

    …the Cosmic Dice Now comes the exciting part! Let's write a function that randomly selects our destination: def select_random_destination(): # Choose a random planet destination =…

  5. Challenge

    Test the pipeline

    …from "Telemetry pipeline" has been split into small functions, ready for the ground station to run unattended. Before it goes live, the team wants tests: whoever changes the pipeline next must find…

    Write the code Hard 2 stages project testing assert try
  6. Article Mini projects

    Calculate your weight on different planets in Python

    …each pair are separated by a colon. Next, let's create a function to calculate weight: def calculate_weight(mass, gravity): return mass * gravity This function multiplies mass by gravity to get…

  7. Article Mini projects

    Medical dispenser - Don’t trust the user

    …hack in action: dispenser = NaiveMedicationDispenser() print(dispenser.request_dose(datetime.now())) # First dose works print(dispenser.request_dose(datetime.now())) # Denied - too soon # The "clever"…

  8. Article Python Fundamentals

    Numbers and Basic Math Operations in Python

    …= travel_time + surface_operations + return_time print(f"Total Mars mission duration: {total_mission_time} days") # Calculating remaining fuel (liters) initial_fuel = 1000000 used_fuel = 850000…