Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- #input
- print("Step right up for a game of Rock, Paper, Scissors!")
- choice = input("What's yer poison? [Rock/Paper/Scissors]: ").lower()
- ai_choice = randint(1,3)
- #pc choice alteration
- if ai_choice == 1:
- ai_choice = "rock"
- elif ai_choice == 2:
- ai_choice = "paper"
- elif ai_choice == 3:
- ai_choice = "scissors"
- #error check
- if choice != "rock" and choice != "paper" and choice != "scissors":
- print(f"{choice} is not a valid option. Get outta here!")
- quit()
- #calculate winner
- print(f"Player: {choice} . . . PC: {ai_choice}")
- if choice == ai_choice:
- print("It's a draw! Dagnabbit.")
- elif choice == 1 and ai_choice == 2:
- print("No dice! You lose.")
- elif choice == 1 and ai_choice == 3:
- print("You win this round, pardner!")
- elif choice == 2 and ai_choice == 1:
- print("You win this round, pardner!")
- elif choice == 2 and ai_choice == 3:
- print("No dice! You lose.")
- elif choice == 3 and ai_choice == 1:
- print("No dice! You lose.")
- else:
- print("You win this round, pardner!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement