diff --git a/GAME-paper-scissors-stone b/GAME-paper-scissors-stone new file mode 100644 index 0000000..f0da997 --- /dev/null +++ b/GAME-paper-scissors-stone @@ -0,0 +1,62 @@ +import random + +outcomes = ["Paper", "Scissors", "Stone"] +userscore = 0 +botscore = 0 + +while True: + try: + games = int(input("How many games would you like to play? ")) + break + except: + print("That isn't a valid number") + +user_to_move = {"a": "Paper", "b" : "Scissors", "c" : "Stone"} + +valid_enteries = ("a", "b", "c") + +while userscore < games and botscore < games: + while True: + try: + user_answer = user_to_move[ + input("\nEnter your choice: (a) Paper, (b) Scissors, (c) Stone \nEnter your letter: ")] + if user_answer == "a" or "b" or "c": + break + except: + print("Invalid input, please try again.") + + print("Your answer is: " + user_answer) + bot_answer = random.choice(outcomes) + print("The bot answered: " + bot_answer) + + + def game_result(useranswer, bot_answer): + if useranswer == bot_answer: + return "Draw" + elif useranswer == "Stone" and bot_answer == "Scissors": + return "You Win!" + elif useranswer == "Paper" and bot_answer == "Stone": + return "You Win!" + elif useranswer == "Scissors" and bot_answer == "Paper": + return "You Win!" + elif useranswer == "Stone" and bot_answer == "Paper": + return "You Lose!" + elif useranswer == "Paper" and bot_answer == "Scissors": + return "You Lose!" + elif useranswer == "Scissors" and bot_answer == "Stone": + return "You Lose!" + else: return "Error" + + if game_result(user_answer, bot_answer) == "You Win!": + userscore += 1 + elif game_result(user_answer, bot_answer) == "You Lose!": + botscore += 1 + else: pass + + print(game_result(user_answer, bot_answer)) + print(f'Your score is {userscore} and the bot score is {botscore}') + +if userscore > botscore: + print("\nFINAL RESULT : YOU'RE A WINNER ! HURRAH !") +else: + print("\nFINAL RESULT: YOU DIDN'T WIN. TRY AGAIN.")