Normalise a command
Operators type commands into Python One's console in their own way: spaces before and after, capital letters, Launch, LAUNCH or launch. The command parser has to understand them all.
Clean up what was typed so it matches the command list, whichever way it was written.
Finish stage 1 to unlock this stage.
Remove the spaces around the typed command and make it lower case, then print it in square brackets, so any spaces left over would show:
Command: [launch]
strip() removes spaces from both ends and lower() turns capitals into small letters. You can call one straight after the other: typed.strip().lower().
Finish stage 1 to unlock this stage.
Now check the clean command against the command list. Compare it with "launch" using == and print the result:
Command: [launch] Matches launch: True
== compares two values and gives True or False. Text only matches when every character is the same, capitals and spaces included.
Finish stage 2 to unlock this stage.
Some operators type Abort_Burn or abort-burn, but the command list says abort burn. The starter code still prints [abort_burn] and False. Turn underscores and dashes into spaces as well, so it prints:
Command: [abort burn] Matches abort burn: True
replace("_", " ") swaps every underscore for a space. Add it, and one for dashes, to the end of the chain.
Hints
String Methods - upper, lower, strip
# String methods - cleaning and checking text
# Imagine a noisy transmission coming in from a deep space probe
raw_signal = " voyager 1: still alive "
# .strip() removes whitespace from both ends
clean = raw_signal.strip()
print("Cleaned:", clean)
# .upper() and .lower() change case
print("Shouted:", clean.upper())
print("Whispered:", clean.lower())
# .title() capitalizes each word - useful for names and headers
print("Headline:", clean.title())
# Checking how a string starts or ends
mission_id = "ARTEMIS-II-2026"
print("Is Artemis?", mission_id.startswith("ARTEMIS"))
print("From 2026?", mission_id.endswith("2026"))
# Replacing parts of a string
log_entry = "Engine status: nominal"
print("Updated:", log_entry.replace("nominal", "OPTIMAL"))
Separate arguments with commas. They're passed on every Run as sys.argv[1:].