Running totals
A variable doesn't have to keep the value you first gave it. During a mission the fuel level changes with every burn and every top-up, and the flight computer keeps one variable up to date instead of creating a new one for each step.
Predict how -= and += change a value, follow the fuel through a whole sequence, then track a battery yourself.
Finish stage 1 to unlock this stage.
Don't run the code yet. Read it and decide what it will print on its last line. Write your guess in prediction, at the top, between the quotes. Then run it and compare.
Any guess passes this stage: the point is to think before you run. After you check, you'll see your prediction next to what Python printed.
Follow fuel_kg line by line: it starts at 5000 and changes twice.
Finish stage 1 to unlock this stage.
Investigate. Work out what fuel_kg holds right after fuel_kg -= burn_1 and store the number in after_first_burn.
Modify. Continue the sequence: the second burn, the top-up and the third burn, each with -= or +=, printing the level after each step:
After burn 1: 3800 kg After burn 2: 3150 kg After top-up: 3550 kg After burn 3: 2700 kg
Finish stage 2 to unlock this stage.
The battery starts full at 100%. During one orbit the comms pass uses 12.5%, the heaters 20.2%, and then solar charging adds 30%. Track it with -= and += and print the level after each step, with one decimal place:
Battery after comms pass: 87.5% Battery after heaters: 67.3% Battery after solar charging: 97.3%
Hints
Creating Variables
# Variables store data under a name
# Create them by assigning a value with =
ship_name = "Project Hail Mary"
crew_count = 3
fuel_remaining = 78.4
in_deep_space = True
print("Ship:", ship_name)
print("Crew:", crew_count, "people")
print("Fuel remaining:", fuel_remaining, "%")
print("In deep space:", in_deep_space)
Separate arguments with commas. They're passed on every Run as sys.argv[1:].