1import random
2
3game_list = ['Rock', 'Paper', 'Scissors']
4computer = c = 0
5command = p = 0
6
7print("Score: Computer" + str(c) + " Player " + str(p))
8
9# the loop
10run = True
11while run:
12 computer_choice = random.choice(game_list)
13 command = input("Rock, Paper, Scissors or Quit: ")
14
15 if command == computer_choice:
16 print("Tie")
17 elif command == 'Rock':
18 if computer_choice == 'Scissors':
19 print("Player won!")
20 p += 1
21 else:
22 print("Computer won!")
23 c += 1
24 elif command == 'Paper':
25 if command == 'Rock':
26 print("Player won!")
27 p += 1
28 else:
29 print("Computer won!")
30 c += 1
31 elif command == 'Scissors':
32 if computer_choice == 'Paper':
33 print("Player won!")
34 p += 1
35 else:
36 print("Computer won!")
37 c += 1
38 elif command == 'Quit':
39 break
40 else:
41 print("Wrong command! ")
42
43 print("Player: " + command)
44 print("Computer: " + computer_choice)
45 print("")
46 print("Score: Computer " + str(c) + " Player " + str(p))
47 print("")
48
1from random import randint
2t = ["Rock", "Paper", "Scissors"]
3computer = t[randint(0,2)]
4print("My Rock, Paper and Scissor Game!!")
5score=0
6C=0
7
8while C<5:
9
10 player = input("What's your move? :")
11 if player == computer:
12 print("Tie!")
13 print(score)
14 elif player == "Rock":
15 if computer == "Paper":
16 print("You lose!", computer, "covers", player)
17 score=score - 1
18 print(score)
19 else:
20 print("You win!", player, "smashes", computer)
21 score = score + 1
22 print(score)
23 elif player == "Paper":
24 if computer == "Scissors":
25 print("You lose!", computer, "cut", player)
26 score = score - 1
27 print(score)
28 else:
29 print("You win!", player, "covers", computer)
30 score = score + 1
31 print(score)
32 elif player == "Scissors":
33 if computer == "Rock":
34 print("You lose...", computer, "smashes", player)
35 score = score - 1
36 print(score)
37 else:
38 print("You win!", player, "cut", computer)
39 score = score + 1
40 print(score)
41 else:
42 print("That's not a valid play. Check your spelling!")
43 C = C + 1
44
45print('Your final score is: ' +str(score))