I am writing a rock, paper and scissors bot for a school project. I keep getting the error in the title (TypeError: randint() takes 3 positional arguments but 4 were given
) and I don't know why. My code is below.
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)
I've said random.randint(1,2,3)
, which is clearly 3 arguments, not 4. I'm, pretty sure my syntax is correct, but not 100%.
random.randint
only takes two arguments, a start and an end. The third argument mentioned by Python is self
, which is done automatically.
To pick a number between 1 and 3, just do random.randint(1,3)
.
Those if
statements don't make any sense, by the way; they should look something like:
if userInput == "paper":
# send discord messages