1import random
2
3rock = '''
4 _______
5---' ____)
6 (_____)
7 (_____)
8 (____)
9---.__(___)
10'''
11
12paper = '''
13 _______
14---' ____)____
15 ______)
16 _______)
17 _______)
18---.__________)
19'''
20
21scissors = '''
22 _______
23---' ____)____
24 ______)
25 __________)
26 (____)
27---.__(___)
28'''
29while True:
30 game_images = [rock, paper, scissors]
31
32 user_choice = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n"))
33 print(game_images[user_choice])
34
35 computer_choice = random.randint(0, 2)
36 print("Computer chose:")
37 print(game_images[computer_choice])
38
39 if user_choice >= 3 or user_choice < 0:
40 print("You typed an invalid number, you lose!")
41 elif user_choice == 0 and computer_choice == 2:
42 print("You win!")
43 elif (computer_choice == 0 and user_choice == 2) or (computer_choice > user_choice):
44 print("You lose")
45 elif user_choice > computer_choice:
46 print("You win!")
47 elif computer_choice == user_choice:
48 print("It's a draw")
49
1import random
2while True:
3 choices = ["rock","paper","scissors"]
4
5 Computer = random.choice(choices)
6 Player = None
7
8
9 while Player not in choices:
10 Player = input("Rock,Paper or Scissors?:").lower()
11
12 if Player == Computer:
13 print("computer:", Computer)
14 print("Player:", Player)
15 print("Draw!")
16
17 elif Player == "rock":
18 if Computer == "paper":
19 print("computer:", Computer)
20 print("Player:", Player)
21 print("YOU WIN !:D")
22 if Computer == "scissors":
23 print("computer:", Computer)
24 print("Player:", Player)
25 print("YOU LOSE:(")
26
27 elif Player == "paper":
28 if Computer == "rock":
29 print("computer:", Computer)
30 print("Player:", Player)
31 print("YOU WIN! :D")
32 if Computer == "scissors":
33 print("computer:", Computer)
34 print("Player:", Player)
35 print("YOU LOSE:(")
36
37 elif Player == "scissors":
38 if Computer == "paper":
39 print("computer:", Computer)
40 print("Player:", Player)
41 print("YOU WIN! :D")
42 if Computer == "rock":
43 print("computer:", Computer)
44 print("Player:", Player)
45 print("YOU LOSE:(")
46
47 Play_again = input("Play again?(Yes/No):").lower()
48
49 if Play_again != "Yes".lower():
50 break
51
52print("Bye!")
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))