Validate a command
The sequencer on Python One takes three commands from the console: start, stop and status. Operators type them in every possible way, and sometimes type something it doesn't know at all.
Accept the three commands however they are typed, reject everything else clearly, then make the error messages helpful.
Finish stage 1 to unlock this stage.
Ask for a command with input(). Accept start, stop and status in any case and with spaces around them, and print what each does. For anything else, print Unknown command. For START :
Starting the sequence
Normalise the answer with strip().lower() straight away, then compare it in an if/elif chain, with else at the end.
Finish stage 1 to unlock this stage.
Make the errors helpful. For an empty answer, ask for a command; for an unknown one, repeat what was typed, without the spaces around it but with its capitals, and list the commands that work:
Type a command: start, stop or status Unknown command: Launch (use start, stop or status)
Keep the typed text in one variable and the lower-case version in another. Check for empty text first. For Launch, the second line is printed.
Hints
If-elif-else Statement
# Oxygen level on a space station
oxygen = 19.5
if oxygen >= 23:
status = "Warning: fire risk"
elif oxygen >= 19.5:
status = "Normal"
elif oxygen >= 16:
status = "Low"
else:
status = "Critical"
print(status)
# Signal delay from a deep space probe
delay = 14.0 # minutes
if delay < 1.3:
location = "Near the Moon"
elif delay < 5:
location = "Inner solar system"
elif delay < 25:
location = "Outer planets region"
else:
location = "Deep space"
print(f"Delay: {delay} min - {location}")
Separate arguments with commas. They're passed on every Run as sys.argv[1:].