Rock Paper Scissors Python Games | Games in Python
Rock , Paper , Scissors
import random
def play():
print("Enter your choice:\n")
user=input("'r' for rock\n's' for scissors\n'p' for paper\n\n")
computer=random.choice(['r','p','s'])
if user==computer:
print("It is a tie...")
elif user=='r' and computer=='s' or user=='s' and computer=='p' or user=='p' and computer=='r':
print("You Won!!")
else:
print("Oh! You Lost! ")
print(f"Oponent choice is : {computer} \n")
print(f"Your choice is : {user}\n")
print(play())
No comments:
Post a Comment