Syntactically, I don’t see anything wrong. Semantically, it won’t work because color
isn’t defined, so you’d want to do something like
color = Color.RED
before your match
, but this is just a diversion from your actual issue, which I suspect is that whatever way you’re running your code is invoking Python 3.9 (or earlier). You could try something like:
from sys import version
print(version)
to see what version your code is actually running under.
Also, for future reference, please don’t post screenshots of code. Post the code as text. Discourse has special blocks for code, which you can access via the icon that looks like </>
.