im creating a rock paper scissors game and for some reason my elifs are not working. keep in mind that im not great at python and i just need an explanation and an example as to how i need to fix it so i can fix it if i run into the same problem at a later date. thanks!
import random
yw="you win"
yl="you lose"
yt="you tie"
uw=0
pw=0
ps=random.randint(1,3)
print("btw computer choices are displayed as 1,2,3. 1=rock, 2=scissors, 3=paper")
while (uw<3) or (pw<3):
if uw==3:
print("you win *overall*")
break
if pw==3:
print("you lose *overall*")
break
us=input("choose a move rock paper or scissors!")
ps=random.randint(1,3)
if us=="rock":
print("you chose {}".format(us))
elif us=="paper":
print("you chose {}".format(us))
elif us=="scissors":
print("you chose {}".format(us))
else:
print("you lose")
pw+=1
elif us=="rock":
if ps==2:
print(ps)
print(yw)
uw+=1
elif:
print(ps)
print(yl)
pw+=1
else:
print(ps)
print(yt)
elif us=="scissors":
if ps==3:
print(ps)
print(yw)
uw+=1
elif:
print(ps)
print(yl)
pw+=1
else:
print(ps)
print(yt)
elif us=="paper":
if ps==1:
print(ps)
print(yw)
uw+=1
elif:
print(ps)
print(yl)
pw+=1
else:
print(ps)
print(yt)
i was expecting to be able to run my code but instead it gives me a syntax error. there isnt a missing if before it and i really dont know whats wrong. thanks!your text
New contributor
LiamDaMepp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1