CREATE STONE PAPER SCISSORS GAME USING PYTHON
HOW TO CREATE STONE PAPER SCISSOR GAME IN PYTHON
stone paper scissors is a very common game .Rock paper scissors is a hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock", "paper", and "scissors". It is a very good game to make with python.
steps to create rock paper scissor game using python:-
OPEN ANY PYTHON IDE AND TYPE FOLLOWING CODE:-
from random import randint
t = ["rock", "paper", "scissors"]
computer = t[randint(0,2)]
player = False
while player == False:
player = input("rock, paper, scissors?")
if player == computer:
print("Tie!")
elif player == "rock":
if computer == "paper":
print("You lose!", computer, "covers", player)
else:
print("You win!", player, "smashes", computer)
elif player == "paper":
if computer == "scissors":
print("You lose!", computer, "cut", player)
else:
print("You win!", player, "covers", computer)
elif player == "scissors":
if computer == "rock":
print("You lose...", computer, "smashes", player)
else:
print("You win!", player, "cut", computer)
else:
print("That's not a valid play. Check your spelling!")
player = False
computer = t[randint(0,2)]
OUTPUT
full video tutorial:-
https://www.youtube.com/watch?v=EBHgA0lbSlc
FOR ANY QUESTION CONTACT ME :-dipuranjansethy143@gmail.com
Comments
Post a Comment