51.3k views
1 vote
Help debugging line 7 type error more arguments (5) than expected (1)

Help debugging line 7 type error more arguments (5) than expected (1)-example-1
User Leedit
by
8.0k points

1 Answer

4 votes

Answer:

import random

score = 0

for i in range(5):

num1 = random.randint(1, 100)

num2 = random.randint(1, 100)

prompt = "What is " + str(num1) + "+" + str(num2) + "?"

answer = int(input(prompt))

result = (num1, num2)

if answer == result:

print("Well done!")

score += 1

else:

print("incorrect")

print("Your score was", score)

Step-by-step explanation:

Your error is on line 7, where you are providing multiple arguments to the input function, instead of 1.

One way to solve this is to create a variable prompt and concatenate all strings and variables within that variable to use for the input.

User Ilya  Shevyryaev
by
8.4k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.