Never-ending wait
After every pass behind the planet, the receiver waits for the antenna signal to get strong enough to lock on. The waiting code should print a line each second and then report the lock. Instead, the ground station screen fills with the same line, over and over, until someone stops the program.
Predict what it does, find out why it never ends, fix it, then write a wait that knows when to give up.
Finish stage 1 to unlock this stage.
Don't run the code yet. Read it and decide what it will print. 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 second through the loop: when does the condition become false?
This program doesn't finish on its own. Run it and watch the console: the loop guard stops it after a while. A program that doesn't finish can't be checked, so then put a # in front of the while line and the line inside the loop, and check: you'll see your prediction next to what the loop did.
Finish stage 1 to unlock this stage.
Investigate. Print second inside the loop to see what it is each time round, and store that number in second_each_time. Then work out how many "waiting" lines there would be if second went up by 1 each time, and store it in waiting_lines. Remove any lines you added before you check.
Modify. Make the loop move on to the next reading each time round. It must print:
T+0s: 3 dB, waiting for lock T+1s: 8 dB, waiting for lock T+2s: 15 dB, waiting for lock T+3s: 42 dB, waiting for lock Signal locked at T+4s
Finish stage 2 to unlock this stage.
On a weaker pass the signal may never reach 60 dB, and the loop would run past the end of the list. Wait while there are readings left and the strength is below LOCK_DB, then print where the signal locked, or that it never did:
No lock after 6 s
After the loop, second < len(strengths) tells the two endings apart. Put the length check first in the while condition.
Hints
While Loop Basics
# A while loop repeats for as long as its condition stays true
passes = 3
while passes > 0:
print("Aerobraking pass,", passes, "to go")
passes = passes - 1
print("Sequence finished")
# The real power: you do not need to know how many turns it will take
altitude_km = 45000
target_km = 400
orbits = 0
while altitude_km > target_km:
altitude_km = altitude_km * 0.7
orbits = orbits + 1
print("Took", orbits, "orbits to reach", round(altitude_km), "km")
# A while loop can also watch a true or false flag
approaching = True
distance_m = 20
while approaching:
print("Range:", distance_m, "m")
distance_m = distance_m - 8
if distance_m <= 0:
approaching = False
print("Soft capture confirmed")
# Forget to change the condition and the loop never ends
# passes = 3
# while passes > 0:
# print("This one never stops")
Separate arguments with commas. They're passed on every Run as sys.argv[1:].