0% found this document useful (0 votes)
28 views3 pages

Mini Project

1. The document defines a rock-paper-scissors game between a player and computer. It initializes scores for each to 0 and choices for the computer to select from. 2. It enters a while loop that repeatedly prompts the player to select rock, paper, or scissors and the computer randomly selects. 3. Based on the selections, it prints whether the player won, lost, or tied against the computer. It updates the respective scores after each round until the player enters "End" to finish the game.

Uploaded by

amankumar1409201
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

Mini Project

1. The document defines a rock-paper-scissors game between a player and computer. It initializes scores for each to 0 and choices for the computer to select from. 2. It enters a while loop that repeatedly prompts the player to select rock, paper, or scissors and the computer randomly selects. 3. Based on the selections, it prints whether the player won, lost, or tied against the computer. It updates the respective scores after each round until the player enters "End" to finish the game.

Uploaded by

amankumar1409201
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1 1mport randoM

2 choices = ["Rock", "Paper", "Scisors"]


3 computer = random. choice( choices)
4 player = Falsse
5 cpu_score = 0

6 player_score =0
7 whille True:
8 player = input("Rock, Paper or Scissors?").capitalize()

9 ## Conditions of Rock, Paper and Scissors


10 if player computer: ==

11 print("Tie! ")
12 elif player ==

"Rock" :
13 if computer ==
"Paper":
14 print("You lose! ", computer, "covers", player)
15 cpu_score+=1
16 else:
17 print("You win! ", player, "smashes", computer)
18 player_score+=1
19 elif player - "Paper":
lf computer == "Scissors" :
20
21 print("You lose!", computer, "cut", player)
22 Cpu_scoret=1
23 else:
24 print("You win!", player "COverS", cOmputer )

25 player_scorer-1
26 elif player "SCISSors"
r m nr "Dar " .
main.pY

12 elif player = "Rock":


13 if computer == "Paper":
14 print("You lose!", computer, "covers", player)
15 cpu_score+=1
16 else:
17 print("You win!", player, "Smashes", Computer)
18 player_score+=1
19 elif player = "Paper":
20 if computer = "Scissors" :
21 print("You lose!", computer, "cut", player)
22 cpu _scoret=1
23 else:
24 printYOu win!" player, "covers ", compu ter )
25 player_scoret=1
26 elif player = "Scissors":
27 if computer ="Rock":
28 print("You lose..", COmpu ter, "Smashes", player)
29 cpu_score+=1
30 else:
31 print("You win!". player, "cut", computer)
32 player_scoret=1
33 elif player-= 'End':
34 print("Final Scores: ")
35 pr int(f"CPU:{cpu_Score}")
36 print(f "Plaer:{player_Score}")
37 break
ell
Paper or SciSsors?
Paper or Scissors?rock
in! Rock smashes Scissors
Paper or Scissors?paper
Dse! SCissors Cut Paper
Paper or Scissors?scissor
Paper or Scissors?rock
n! Rock smashes Scissorss
Paper or Scissors?

You might also like