Challenge
Round or cut?
…gives 2. Predict the difference, investigate Python's rounding rule, then round a fuel reading two ways.
Showing 1–10 of 11
Challenge
…gives 2. Predict the difference, investigate Python's rounding rule, then round a fuel reading two ways.
Challenge
…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…
Challenge
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().
Challenge
Predict 0.1 + 0.2, see the 0.30000000000000004 that every programmer meets once, then round it for display the way fuel gauges and dashboards do.
Challenge
Print 7.6612 as Speed: 7.66 km/s, 1234567 as Mass: 1,234,567 kg and a fuel fraction as a percentage, using format specs in f-strings.
Challenge
…and seconds, then add the round trip without doubling a rounding error.
Quiz
…on +, -, *, /, //, %, **, operator precedence and rounding, with instant answers.
Challenge
…average that takes the values as they come, then give it a rounding option. Loose values and a list Write average(*values) , which takes any number of numbers and returns their mean. Call it with…
Challenge
…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"…
Challenge
…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…