不确定这里是否有错误,在第19行出现语法错误。删除冒号会使错误向前移动。我认为这可能与缩进有关,但我不确定。
import time
import random
print('Scissors? Paper? or Rock?')
playerchoice = input()
if playerchoice == 'rock' | 'Rock' | 'ROCK' | 'r' | 'R':
playerval = 1
elif playerchoice == 'scissors' | 'Scissiors' | 'SCISSORS' | 's' | 'S':
playerval = 2
elif playerchoice == 'paper' | 'Paper' | 'PAPER' | 'p' | 'P':
playerval = 3
else:
print('Invalid input')
roboval = (random.randint(0,4)
if roboval == 3 & playerval == 1:
playerval = 4
if playerval == 3 & roboval == 1:
roboval = 4
if playerval > roboval:
resultwin = 1
else:
resultwin = 0
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。