I was trying to adjust this code so it accepts if I wrote rock , paper or scissor in small or capital letter. and if it wasn't one of these three words then it should exit the program and print "WRITE IT CORRECTLY!")
import random
y = input("Enter rock, paper or scissor: ")
x = ["rock","paper","scissor"]
z = random.choice(x)
c = print("Computer: " + str(z) )
if (y=="rock" and z=="scissor"):
print("YOU WON!")
elif (y=="rock" and z=="paper"):
print("COMPUTER WON!")
elif (y=="rock" and z=="rock"):
print("TRY AGAIN!")
elif (y=="paper" and z=="rock"):
print("YOU WON!")
elif (y=="paper" and z=="paper"):
print("TRY AGAIN!")
elif (y=="paper" and z=="scissor"):
print("COMPUTER WON!")
elif (y=="scissor" and z=="rock"):
print("COMPUTER WON!")
Aucun commentaire:
Enregistrer un commentaire