rock paper scisor game
for the exact code:
https://github.com/animeesh/game-rock-paper-scissor
code random lib is used to get the random value
import random
#input_list = ["Rock", "Paper", "Scissor"]
while True:
input_user = input("Select the input: ")
print (input_user)
possible_action=["rock","paper","scissor"]
computer_action=random.choice(possible_action)
print(f"\nyou chose :{input_user},computer chose :{computer_action}.\n")
#hear starts the real technique
if input_user ==computer_action:
print(f"both player selected {input_user}.hence its a tie!")
elif input_user== "rock":
if computer_action=="scissor":
print("rock smashes scissor! you win")
else:
print("paper covers the rock! you lose")
elif input_user== "paper":
if computer_action=="rock":
print("paper covers the rock! you win")
else:
print("scissor cuts the paper! you lose")
elif input_user== "scissor":
if computer_action=="rock":
print("rock smashes scissor! you win")
else:
print("rock smashes the scissor! you lose")
play_again=input("play again enter y/n :")
if play_again.lower()!= "y":
break
Comments
Post a Comment