(light)
| 156 | GREEN = "green" |
| 157 | |
| 158 | def take_enum_action(light): |
| 159 | match light: |
| 160 | case ColorEnum.RED: # Changed |
| 161 | print("Stop") |
| 162 | case ColorEnum.YELLOW: # Changed |
| 163 | print("Slow down") |
| 164 | case ColorEnum.GREEN: # Changed |
| 165 | print("Go!") |
| 166 | case _: |
| 167 | raise RuntimeError |
| 168 | |
| 169 | take_enum_action(ColorEnum.RED) |
| 170 | take_enum_action(ColorEnum.YELLOW) |