Today we are going to teach you how to program the mythical rock, paper, scissors with a simple code.
Python is one of the most powerful and used languages today. He Master in Advanced Programming in Python will train you to be a programmer expert in areas as prominent and current as Big Data, Hacking, Machine Learning.
random method
We will use the random method so that it automatically generates the “play” of the machine.
The code is very simpleOn the one hand, we generate a random number with random between 0 and 3 that will be the machine's move. Then with a simple menu we will make our choice and then we just have to consider all the options with the if conditional.
On the other hand, if we want to play several times, we will only have to enter a while loop in the game with the typical yes or no question at the end.
So our complete code It would look like this:
I liked your code, it really helped me to learn a little more about python 👍
Thank you