def check_http_status(status_code): """Prints a message based on the HTTP status code.""" match status_code: case 200: print("200. Status: OK") case 403: print("403. Status: Forbidden") case 404: print("404. Status: Page Not Found") case 405: print("405. Status: Method not supported") case 500: print("500. Status: Server Error") case _: # The wildcard case for any other value print("Other code. Status: Unknown") check_http_status(200) check_http_status(403) check_http_status(404) check_http_status(405) check_http_status(500) check_http_status(999) # This is a more advanced example that will not appear in exams. def process_command(command): """Parses and executes a command represented as a list of strings.""" match command: case ["quit"]: print("Exiting...") case ["go", direction]: # the second argument of 'command' is stored in the variable direction print(f"Moving in direction: {direction}") case ["get", *item]: # the second and following arguments of 'command', if exsit, is stored in the list item. if item: print(f"Picking up item {item}") else: print("What do you want to get?") case _: print("Invalid command.") print(f"process_command(['go', 'east']): ", end='') process_command(['go', 'east']) print(f"process_command(['get', 'sword']): ", end='') process_command(['get', 'sword']) print(f"process_command(['get']): ", end='') process_command(['get']) print(f"process_command(['use', 'sword']): ", end='') process_command(['use', 'sword']) print(f"process_command(['quit']): ", end='') process_command(['quit'])