Created
July 27, 2022 13:28
-
-
Save Amaya910/63e35ca46165300846082e41e8e23970 to your computer and use it in GitHub Desktop.
ROCK PAPER SCISSOR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
tie = 0 | |
human = 0 | |
computer = 0 | |
keep_playing = True | |
while keep_playing: | |
human_choice = input(" Your choice : rock, paper or scissor ") | |
computer_choice = random.choice(['rock', 'paper', 'scissor']) | |
print('The user chooses ' + human_choice) | |
print('The computer chooses ' + computer_choice) | |
if human_choice == "rock": | |
if computer_choice == "rock": | |
print("tie") | |
tie = tie + 1 | |
if computer_choice == "paper": | |
print("computer wins") | |
computer = computer + 1 | |
if computer_choice == "scissor": | |
print("human wins") | |
human = human + 1 | |
if human_choice == "paper": | |
if computer_choice == "paper": | |
print("tie") | |
tie = tie + 1 | |
if computer_choice == "rock": | |
print("human wins") | |
human = human + 1 | |
if computer_choice == "scissor": | |
print("computer wins") | |
computer = computer + 1 | |
if human_choice == "scissor": | |
if computer_choice == "scissor": | |
print("tie") | |
tie = tie + 1 | |
if computer_choice == "rock": | |
print("computer wins") | |
computer = computer + 1 | |
if computer_choice == "paper": | |
print("human wins") | |
human = human + 1 | |
# code that plays one round** | |
print("Do you want to play again?") | |
answer = input() | |
if answer == "no": | |
keep_playing = False; | |
print("SCORE ") | |
print("human: " + str(human)) | |
print("computer: " + str(computer)) | |
print("ties: " + str(tie)) | |
if human > computer: | |
print(" You won! You did a great job") | |
elif human < computer: | |
print("computer won") | |
elif human == computer: | |
print("It was a tie! ") | |
print("Thanks for playing!") | |
elif answer == " yes ": | |
keep_playing = True; | |
print("OK") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the rock paper scissor code i made using python...