• API
• FAQ
• Tools
• Archive
SHARE
TWEET # Untitled a guest Mar 31st, 2020 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import random
2.
3. state_of_game = 1
4.
5.
6. def enemyChoice():
7.     enemy_choice = random.randint(1, 3)
8.     if enemy_choice == 1:
9.         enemy_choice = "scissors"
10.     if enemy_choice == 2:
11.         enemy_choice = "rock"
12.     if enemy_choice == 3:
13.         enemy_choice = "paper"
14.     return enemy_choice
15.
16. human_choice = input("rock paper or scissors:")
17. computer_choice = enemyChoice()
18. print("Your Choice:" + human_choice + "     V.S.    Computer Choice:" + computer_choice)
19.
20. Cwin = "Computer Wins!"
21. Hwin = "Human Wins!"
22. T = "Tie!"
23.
24. if human_choice and computer_choice:
25.     if human_choice == "scissors" and computer_choice == "rock":
26.         print(Cwin)
27.     if human_choice == "scissors" and computer_choice == "paper":
28.         print(Hwin)
29.     if human_choice == "scissors" and computer_choice == "scissors":
30.         print(T)
31.     if human_choice == "paper" and computer_choice == "paper":
32.         print(T)
33.     if human_choice == "paper" and computer_choice == "rock":
34.         print(Hwin)
35.     if human_choice == "paper" and computer_choice == "scissors":
36.         print(Cwin)
37.     if human_choice == "rock" and computer_choice == "rock":
38.         print(T)
39.     if human_choice == "rock" and computer_choice == "paper":
40.         print(Cwin)
41.     if human_choice == "rock" and computer_choice == "scissors":
42.         print(Hwin)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top