I'm traying to make a simple rock paper scissors game but it seems that the if
and elif
statement do not respond. It only print
s the else
statement.
Here's the code:
from random import randint
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
t = [rock, paper, scissors]
player = int(input("choose 0 for rock and 1 for paper and 2 for scissors
"))
cpu = t[randint(0,2)]
print(t[player])
print(cpu)
if player == 0 and cpu == 2:
print("YOU WIN")
elif cpu == 0 and player == 2:
print("YOU LOSt")
elif player == 1 and cpu == 0:
print("you win")
elif cpu == 1 and player == 0:
print(" YOU LOST")
else:
print("this is invalid input! ")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…