#Akshat shah
#Project 2
#This import function allows the random.randrange function to work
import random
human_score = 0.0
computer_score = 0.0
#This is the while loop that randomly chooses rock, paper and scissors, if we enter correct input value
while True:
#Allows me to enter rock paper scissors
human_play = input("Enter human play(rock,paper,scissors):")
#Random function chooses random numbers from 0 to 2, you have to always put the range a number more than the one you want to add.
random_number = random.randrange(0,3)
if random_number == 0:
computer_play ="rock"
elif random_number == 1:
computer_play ="paper"
elif random_number == 2:
computer_play ="scissors"
#case 1
#This commands and all the commands below are the if statements that tells us that if we input rock, the computer will randomly choose something from
#rock paper scissors and than if the computer has rock too, it will tell you its a tie because we have added print statement, and adds assign points to
#human or computer
if human_play == "rock" and computer_play == "rock":
print("Computer played rock")
print("rock does not go with rock")
print("Tie")
computer_score = computer_score + 0.5
human_score = human_score + 0.5
#case 2
elif human_play == "rock" and computer_play =="paper":
print("Computer played paper")
print("paper covers rock")
print("Computer wins")
computer_score = computer_score + 1.0
#case 3
elif human_play == "rock" and computer_play == "scissors":
print("Computer played scissors")
print("rock breaks scissors")
print("Human wins")
human_score = human_score + 1.0
#case 4
elif human_play == "paper" and computer_play == "rock":
print("Computer played rock")
print("paper covers rock")
print("Human wins")
human_score = human_score + 1.0
#case 5
elif human_play == "paper" and computer_play == "paper":
print("Computer played paper")
print("paper does not go with paper")
print("Tie")
computer_score = computer_score + 0.5
human_score = human_score + 0.5
#case 6
elif human_play == "paper" and computer_play == "scissors":
print("Computer played Scissors")
print("paper gets cut off by scissors")
print("computer wins")
computer_score = computer_score + 1.0
#case 7
elif human_play == "scissors" and computer_play =="rock":
print("Computer played rock")
print("rock breaks scissors")
print("computer wins")
computer_score = computer_score + 1.0
#case 8
elif human_play == "scissors" and computer_play == "paper":
print("Computer played paper")
print("scissors cuts paper")
print("Human wins")
human_score = human_score + 1.0
#case 9
elif human_play == "scissors" and computer_play =="scissors":
print("Computer played scissors")
print("Scissors does not go with scissors")
print("Tie")
computer_score = computer_score + 0.5
human_score = human_score + 0.5
#This print statement allows to print human and computer score at the end of each queries
print("Human score:", human_score,"computer score:", computer_score)