Results for “calculations”

7 results

  1. Challenge

    Extract a function

    Move a 3D distance calculation that is copied for three waypoints into distance_km(a, b), keeping the output exactly the same, then put the waypoints in a dict and find the nearest one with the same…

    Fix the code Easy 2 stages functions refactoring return tuples
  2. Challenge

    Duration formatter

    …way there is: seconds since launch. That's perfect for calculations and useless at a glance. Is 100000 seconds one day or three? Turn it into the clock the flight controllers read, one step at a time…

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

    Live T-minus

    …should count up: T+00:05:00 five minutes in. Move the calculation into countdown(launch, now) , which returns the text with T- before launch, and at launch itself, and T+ after it, then print…

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

    Clear error messages

    …can't be negative: {burn_s} s") inside an if , before the calculation. A burn of 0 seconds is allowed. Raise TypeError A burn length read from a file arrives as the text "40" , and the function stops…

    Write the code Medium 2 stages errors raise ValueError TypeError
  5. Challenge

    Wrong average

    …any line you added before you check. Modify. Fix the calculation so it averages all three readings: add them up first, then divide. It must print: Average hull temperature: 20.9 °C Make: Average speed…

    Fix the code Easy 3 stages order of operations brackets average debugging
  6. Challenge

    Float surprise

    …go into the tank. Adding them up should be the easiest calculation on board, and yet Python prints something nobody expects. Predict it, look closely at what came out, then make the display show what…

    Write the code Easy 3 stages float floating point rounding formatting