Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Noah Cabral
- from random import randint
- userWin= 0 # user win total
- compWin = 0 #computer win total
- tie = 0 #tie total
- print ("Hello! Welcome to rock, paper, scissors!")
- print ("The objective is simple, you and the computer each choose either rock, paper, or scissors")
- print ("The winner is determined by these standards: Rock beats scissors, scissors beat paper, and paper beats rock!")
- while True :
- print ("")
- choice = input ("Please choose rock, paper, or scissors") #gets users choice
- computer = randint (1,3) #generates computers choice
- userNum = 0 #value of users guess
- #sets computers value where 1 = rock, 2 = paper, 3 = scissors
- print ("")
- if computer == 1:
- print ("The computer chooses rock")
- elif computer == 2:
- print ("The computer chooses paper")
- elif computer == 3:
- print ("The computer chooses scissors")
- #sets users value where 1= rock, 2 = paper, 3 = scissors
- print ("")
- if choice == "rock" :
- userNum = userNum + 1
- elif choice == "paper":
- userNum = userNum + 2
- elif choice == "scissors":
- userNum = userNum + 3
- #deteremins outcome
- if userNum == 1 and computer == 3:
- print ("Your rock crushes the computer's scissors!")
- userWin = userWin + 1
- elif userNum == 2 and computer == 1 :
- print ("Your paper covers the computer's rock!")
- userWin = userWin + 1
- elif userNum == 3 and computer == 2:
- print ("Your scissors cut the computer's paper!")
- userWin = userWin + 1
- elif computer == 1 and userNum == 3:
- print ("The computer's rock crushes your scissors!")
- compWin = compWin + 1
- elif computer == 2 and userNum == 1:
- print ("The computer's paper covers your rock!")
- compWin = compWin + 1
- elif computer == 3 and userNum == 2:
- print ("The computer's scissors cut your paper!")
- compWin = compWin + 1
- else :
- print ("Its a tie!")
- tie = tie + 1
- print ("")
- end = input("Would you like to keep playing?")
- if end == "no" :
- break
- print ("")
- print ("You had",userWin,"wins")
- print ("")
- print ("The computer had",compWin,"wins")
- print ("")
- print ("There was",tie,"ties")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement