继续获取此语法错误
TypeError: input expected at most 1 arguments, got 3
有人知道怎么解决这个问题吗?你知道吗
from random import randint
from tkinter import *
po = ["Rock", "Paper", "Scissors"]
player = False
cpu = po[randint(0, 2)]
while player == False:
player = input("Rock", "Paper", "Scissors?")
if player == computer:
print("Tie")
elif player == "Rock":
if computer == "Paper":
print("You lose!", computer, "covers", player)
else:
print("You win!", player, "smashes", computer)
elif player == "Paper":
if computer == "Scissors":
print("You lose!", computer, "cuts", player)
else:
print("You win!", player, "covers", computer)
elif player == "Scissors":
if computer == "Rock":
print("You lose!", computer, "smashes", player)
else:
print("You win!", player, "cut", computer)
else:
print("That's not a valid play. Check your spelling!")
player = False
computer = po[randint(0,2)]
似乎你从来没有真正给这个人一个机会去输入石头、布或剪刀,你可能应该做一些类似的事情
这样玩家就可以被分配到玩家选择的任何一个
你误用了
input
。传递给它的参数只是提示,因此只能是单个字符串。你知道吗可能更像你想要的。你知道吗
相关问题 更多 >
编程相关推荐