Using python 3.7.3. all documentation is points to this being the correct way to do a switch statement in python. Not sure why it's not working. Am I supposed to import match? syntax error below.
match player:
^
def evaluate(player, ai):
match player:
case Choice.rock:
if ai == Choice.rock:
return "draw"
elif ai == Choice.scissors:
return "player wins"
elif ai == Choice.paper:
return "ai wins"
case Choice.paper:
if ai == Choice.rock:
return "player wins"
elif ai == Choice.scissors:
return "ai wins"
elif ai == Choice.paper:
return "draw"
case Choice.scissors:
if ai == Choice.rock:
return "ai wins"
elif ai == Choice.scissors:
return "draw"
elif ai == Choice.paper:
return "player wins"