Challenge
Fuel for a burn
…can last part of a second, like 12.4. When you press Run, type the number in the console. When you check, the tests type it for you. What the burn leaves The flight director also wants to know what…
Showing 11–20 of 40
Challenge
…can last part of a second, like 12.4. When you press Run, type the number in the console. When you check, the tests type it for you. What the burn leaves The flight director also wants to know what…
Challenge
code[0] = "X" stops with a TypeError, because Python strings can't be changed. Predict the crash, find out what methods and slices really give, build a new string instead, then swap a letter in the…
Challenge
An operator types 42,5 and float() crashes with a ValueError. Predict it, find out why, accept both commas and dots with replace(), then read pressures written like 1 013,25.
Challenge
Write parse_command(), which turns typed commands such as burn 12.5 or set mode safe into tuples and raises ValueError with a reason for anything malformed, then run a whole batch of commands and…
Challenge
The burn length is typed in by hand, and a typo stops the program with a ValueError. Catch it with try and except, keep asking until the input is a number, then also turn away zero and negative…
Challenge
int() cuts the decimals off, round() rounds, and round(2.5) gives 2. Predict the difference, investigate Python's rounding rule, then round a fuel reading two ways.
Challenge
…whole items rather than parts of text, then normalise IDs typed by hand and print a clear cleared or not-cleared message.
Challenge
…anything else, then handle empty input and show what was typed.
Challenge
…settings over a copy of the defaults, check each value's type and range and report every problem in one go, then wrap it all in a load_config() that never crashes, even on broken JSON.
Challenge
…gives back and store it, as text, in returned . Then print type(engine_k) and store the type's name in value_type . Remove any lines you added before you check. Modify. Make to_kelvin() give its…