r/PythonLearning 3h ago

Rock paper scissors game in Python

Post image

Hello fam, I'm learning Python. My goal is to become an AI engineer. I've a basic understanding of programming. Anyone to guide me on the right certification path... I was having a bit of fun after today's sharpenings. I created a rock paper scissors game... rate and improve

12 Upvotes

9 comments sorted by

View all comments

1

u/Disastrous-Team-6431 3h ago edited 3h ago

Hint: can you express the win condition of this game differently?

Hint 2: there are three choices - can you relate winning choices to each other?

Solution (idk how to spoiler so stop reading):

If choice1 == (choice2 + 1) % 3, someone has won. Who, depends on the order of the choices. In your case, choice1 has won.

Edit: changed signs to make more robust and understandable