Challenge
Summary function
…'mean': 419.5} Build the dict in the return line, with len() , min() , max() and sum() / len() . No data, and a rounded mean The second pass had no data, and min([]) stops with a ValueError . For an…
Showing 11–20 of 45
Challenge
…'mean': 419.5} Build the dict in the return line, with len() , min() , max() and sum() / len() . No data, and a rounded mean The second pass had no data, and min([]) stops with a ValueError . For an…
Challenge
…0.5, then add a third waypoint and print each leg and the length of the whole route.
Challenge
…shifts: 0 Count the shifts in slot as you go: crew[slot % len(crew)] wraps round to the first person after the last. {name:<10} pads the names into columns. Days off, fairly Now some of the crew have…
Challenge
…convert leg 2 before it's added. It must print: Trajectory length: 386,294 km Make: Landing in metres A lander's altitude comes from its radar in metres, but the backup sensor reports the descent rate…
Challenge
…419.5 Inside the function, values is a tuple, so sum() and len() work on it. In the second call, average(*readings) passes the five readings as five separate arguments. An option after the values Add…
Challenge
…a line with too few fields raises ValueError too. Drop the length check and let one try cover both the unpacking and the conversion. For each line it skips, print the line and the error's message…
Challenge
…kg CG-0046 | Tablet computers | 3.4 kg CG-0047 | Rice and lentils | 25.0 kg Loop over cargo ; each record is a dict, so record["id"] , record["item"] and record["mass_kg"] give its fields. The total…
Challenge
…an operator at a European ground station types the burn length the way it is written in Poland and much of Europe, 42,5 , and the program stops. Predict what happens, find out why, make the calculator…
Challenge
A 70-line engine report repeats the same twelve lines for each engine. Restructure it into parse_feed() and summary_line() with the output unchanged to the character, then add assert tests that would…
Challenge
Write assert checks for mean(): an ordinary list and a list with one value first, then the edge cases, an empty list that should give None and lists with negative values, so broken copies of the…