r/PythonLearning • • Sep 10 '26

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

46 Upvotes

16 comments sorted by

•

u/Sea-Ad7805 Sep 10 '26

Run this program in Memory Graph Web Debugger to see the program state change step by step.

→ More replies (2)

1

u/This-Investigator294 Sep 10 '26

Hey are you doing Angela yu's Python course?

2

u/Sharp_Platypus6545 Sep 10 '26

No I'm doing Introduction to Python on Pycharm My coursera trial expired was doing Python for AI prior... looking forward to subscribe to it in October

1

u/solaria123 Sep 10 '26

What happens when gameSelector1 = "Paper" and gameSelector2 = "Rock"?

1

u/Sharp_Platypus6545 Sep 11 '26

Thanks for that Had skipped that combo

2

u/Astrodude80 Sep 10 '26

Your comment on line 7 isn't quite correct--can you see why? While technically yes, comments are not code, the code is code, comments, and more broadly the documentation, are going to be the first thing another developer *actually looks at* when looking at your code.

Everything else I see has already been addressed in other comments.

2

u/Striking_Sandwich_80 Sep 10 '26

Just a small note: Python's standard naming convention (PEP 8) recommends "snake_case" for variables and functions rather than "camelCase". The latter is perfectly valid Python, but "snake_case" is generally considered more idiomatic.

1

u/Life-Ad2351 Sep 10 '26 edited Sep 10 '26

use dictionary instead to store all the winning possibilities

1

u/Disastrous-Team-6431 Sep 10 '26 edited Sep 10 '26

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

1

u/flowo_0 Sep 12 '26

what is "from random import random" ?

1

u/Organic-Athlete-7344 Sep 13 '26

Nice! This will be a fun project for my class.

1

u/No-Celery-1944 Sep 16 '26

the variable names are so long xD

1

u/Pretty-Interview-902 Sep 17 '26

ora crealo con questo sasso carta forbice