我正在为一个学校项目写一个石头,纸和剪刀机器人。我总是在标题中发现错误(TypeError: randint() takes 3 positional arguments but 4 were given
),我不知道为什么。我的代码在下面。
if userInput : 'rock'
choice = random.randint(1,2,3)
if choice == 1:
await client.send_message(message.channel, embed=RockEmbed)
elif choice == 2:
await client.send_message(message.channel, embed=PaperEmbed)
elif choice == 3:
await client.send_message(message.channel, embed=ScissorsEmbed)
if userInput : 'scissors'
choice2 = random.randint(1,2,3)
if choice2 == 1:
await client.send_message(message.channel, embed=RockEmbed)
elif choice2 == 2:
await client.send_message(message.channel, embed=PaperEmbed)
elif choice2 == 3:
await client.send_message(message.channel, embed=ScissorsEmbed)
if userInput : 'paper'
choice3 = random.randint(1,2,3)
if choice3 == 1:
await client.send_message(message.channel, embed=RockEmbed)
elif choice3 == 2:
await client.send_message(message.channel, embed=PaperEmbed)
elif choice3 == 3:
await client.send_message(message.channel, embed=ScissorsEmbed)
我说过random.randint(1,2,3)
,这显然是3个参数,而不是4个。我很确定我的语法是正确的,但不是100%。
目前没有回答
相关问题 更多 >
编程相关推荐