Results for “rounding”

Showing 1–10 of 11

  1. Challenge

    Packing crates

    …Crates needed: 9 Tubes in the last crate: 4 Empty slots: 8 Rounding a division up is a classic trick: (tubes + slots_per_crate - 1) // slots_per_crate . Adding one tube less than a full crate pushes…

    Write the code Medium 2 stages floor division modulo rounding up //
  2. Challenge

    Tank level

    Turn a tank's capacity and contents into a fill percentage with one decimal place, then draw the crew display's ten-segment gauge with string repetition and int().

    Write the code Easy 2 stages percentage division rounding string repetition
  3. Challenge

    Signal delay

    …and seconds, then add the round trip without doubling a rounding error.

    Write the code Medium 3 stages division round // %
  4. Challenge

    Extract a function

    …function, use a and b instead of ship and a waypoint. The rounding stays in the prints. The nearest waypoint Put the waypoints in a dict, waypoints = {"A": waypoint_a, "B": waypoint_b, "C"…

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

    Downlink time

    …to the second. Show whole minutes and seconds instead, rounding to the nearest second first. For a 1250 MB file at 6 Mbit/s: Downlink time: 27 min 47 s The same trick as in "Signal delay": round, then…

    Write the code Medium 3 stages input float bits and bytes round