TypeError: input expected at most 1 argument, got 2

Viewed 2273

This is my code and I keep getting the error

TypeError: input expected at most 1 argument, got 2

How do I fix?

enter image description here

4 Answers

The error seems clear to me. The input function expects one parameter -- the prompt string -- and you have provided two. I don't know what you were trying to do with the [], but you need to delete it.

aos input() doesn't accept [] as second parameter. You can send it as string from conse not like array.

I read your entire code and I think what you mean to do is

aos = input("Are you adding or subtracting")
answer = ['Adding','Subtracting']

And then after that in the if statements

if aos == answer[0]:
   print("The solution is",sol1)
elif aos == answer[1]:
   print("The solution is",sol2)
  

Replace

aos = input("Are you adding or subtracting:", [])

with

aos = input("Are you adding or subtracting:")

As the input() method takes in a maximum of 1 argument, keyword or positional.

Related