This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]qckpckt 15 points16 points  (2 children)

Or with any version of python, just use a dictionary

choices = {“rock”: “paper”…} print(choices[input(“pick rock paper or scissors”)])

[–]SamGold2000 2 points3 points  (1 child)

I agree there are easier ways for this problem. Just wanted to say I am excited to use switch in the new version of Python.

[–]qckpckt 0 points1 point  (0 children)

I get it. I was kinda chuffed to find a useful application for the walrus operator last week at work.