Use a dict to classify HTTP status codes: map 200 to 'OK', 301 to 'Redirect', 404 to 'Not Found', 50
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
Use a dict to classify HTTP status codes: map 200 to 'OK', 301 to 'Redirect', 404 to 'Not Found', 500 to 'Server Error'. Look up codes 200, 404, and 999 (using .get with default 'Unknown'). Print each result.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.