Python · Exercise 6 of 6 Previous
Beginner
Name an HTTP status with match
Use a match statement on the variable status to set the variable message: "OK" for 200, "Redirect" for 301 or 302, "Not found" for 404, "Server error" for 500, 502 or 503, and "Unknown" for anything else.
Then print Status followed by the status, a colon and the message, such as Status 404: Not found.
What Check tests
- 404 gives
Not found - 302 gives
Redirect - 502 gives
Server error - 418 gives
Unknown - 200 gives
OKand 503 givesServer error - Your code uses
match - The program prints
Status 404: Not found
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.