Fuel for a burn
An engine burn changes Python One's orbit, and every second of it costs propellant. Before each burn, the flight software asks the crew how long the burn will be and shows what it will cost.
Write that tool: read the burn length from the keyboard, work out the fuel it uses, then what's left in the tank.
Finish stage 1 to unlock this stage.
The main engine uses 7.5 kg of propellant every second. Read the burn length with input() and print the fuel it uses, with one decimal place. For 42:
Fuel used: 315.0 kg
input() always gives text, so turn it into a number with float(): burns 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.
Finish stage 1 to unlock this stage.
The flight director also wants to know what the burn leaves. After the burn length, ask for the fuel in the tank, in kg, and print three lines. For a 42-second burn and 1200 kg in the tank:
Fuel used: 315.0 kg Fuel left: 885.0 kg Longest burn left: 118.0 s
The longest burn left is how long the engine could still fire on the fuel that's left.
Hints
Type Conversion
# Telemetry always arrives as text, even when it looks like a number
impact_speed_text = "22530"
orbit_change_text = "32.0"
# int() turns a string of digits into a whole number
impact_speed = int(impact_speed_text)
print("DART hit Dimorphos at", impact_speed, "km/h")
print("That is", round(impact_speed / 3600, 2), "km every second")
# float() does the same job for a decimal
orbit_change = float(orbit_change_text)
print("Orbit shortened by", orbit_change, "minutes")
# str() goes the other way. Plus only joins text to text
year = 2022
print("Impact year: " + str(year))
# print("Impact year: " + year) # delete the hash sign to meet a type error
# int() on a decimal chops off the fraction, it does not round
hours_per_orbit = 11.92
print("int gives", int(hours_per_orbit), "but round gives", round(hours_per_orbit))
# A decimal hiding inside a string needs float() first
raw = "11.92"
print("Converted safely:", int(float(raw)))
# print(int(raw)) # this one raises a value error
# type() confirms what you are actually holding
print(type(impact_speed_text), type(impact_speed), type(orbit_change))
Separate arguments with commas. They're passed on every Run as sys.argv[1:].