Hey friends, today in this blog you’ll learn how to make a Working game in Python. I’ll use the only Python to create this game. Its name is rock, paper, scissors. In the earlier blog, I have shared how to find areas of a rectangle using Python and it’s time to create a game using Python.
It is a game for children and it is also for those who are finding some mini project in Python. In this game, we take input from the user. If the user enters R then it means he has chosen Rock and if he enters P then it means he has chosen Paper last but not least if the user enters S then it means he has chosen Scissor.
You might like this:
Here is the concept of the game
#------------ Created by Coding Gyan -------------import random#------------ Rock, Paper, and Scissors -------------def whoWin(comp, you):if comp==you:return Noneelif comp=='s':if you=='p':return Falseelif you=='r':return Trueelif comp=='p':if you=='r':return Falseelif you=='s':return Trueelif comp=='r':if you=='s':return Falseelif you=='p':return Truecomp = print('Computer\'s turn: Choose Rock(r), Papaer(p) and Scissors(s)')you = input('Your turn: Choose Rock(r), Papaer(p) and Scissors(s) => ')random = random.randint(1, 3)if random==1:comp = 'r'elif random==2:comp = 'p'else:comp = 's'w = whoWin(comp, you)if w==True:print('You win the Game:)')elif w==False:print('You loss the Game!')else:print('The Game is Draw')