(light)
| 67 | |
| 68 | print("Example 3") |
| 69 | def take_match_action(light): |
| 70 | match light: |
| 71 | case "red": |
| 72 | print("Stop") |
| 73 | case "yellow": |
| 74 | print("Slow down") |
| 75 | case "green": |
| 76 | print("Go!") |
| 77 | case _: |
| 78 | raise RuntimeError |
| 79 | |
| 80 | |
| 81 | take_match_action("red") |