diff --git a/Python/Simple game b/Python/Simple game new file mode 100644 index 00000000..6891a4c5 --- /dev/null +++ b/Python/Simple game @@ -0,0 +1,32 @@ +import random + +def play(): + + user=input("'r' for rock,'p' for paper,'s' for scissor") + + computer=random.choice(['r','p','s']) + + if user==computer: + + return 'It is a tie' + + if is_win(user,computer): + + return 'You Won!' + + else: + + return 'You Lost!' + + + +def is_win(player,opponent): + + if(player=='r' and opponent=='s') or(player=='s' and opponent=='p') or (player=='p' and opponent=='r'): + + return True + + + +print(play()) +