Stone_paper_scissor

Hi,

I recently made a game of stone paper scissor by Python. It consists of three rounds. The player competes with the computer. The one who wins the round gets a point. After three rounds, the one who has the highest number of points is the winner.

The source code:
The URL - Click here!

I have posted it for review. Any suggestion will be appreciated.
THANK YOU

1 Like

why didn’t you name it rock paper scissors? Its the common english name for this game

you have some repetitive code, this:

               print( "----------------------------------" )
               print( "YOU WIN!" )
               print( "----------------------------------" )
               print("COMPUTER:"+ comp_g)
               print("USER:"+ user_g)
               user += 1
               print("USER: %d" %(user))
               print("COMPUTER: %d" %(comp))

i see several times through your code, couldn’t it be abstracted so its not violating DRY principle?

what if the user gives invalid choice? Shouldn’t it be validated the user made a valid choice?

2 Likes

We Indians teens mostly call it as Stone paper scissor. That’s why I named it so.

I don’t get what you mean the ‘DRY principle’, so I would request you to tell me about that.

1 Like

there is a even a wikipedia page about it:

https://en.wikipedia.org/wiki/Don't_repeat_yourself

its an abbreviation, it means: don’t repeat yourself.

1 Like

So how to can apply this principle and what does it mean by abstraction.

By the way, is the URL posted by me on my post okay, because I think that my personal information can get vulnerable?

1 Like

you could write a function? Then you can call the function when something specific needs to be printed.

no, why would that be the case?

1 Like