这是我的代码,我一直收到错误
TypeError: input expected at most 1 argument, got 2
我该如何修复?
发布于 2021-03-20 10:11:48
这个错误在我看来是显而易见的。input
函数需要一个参数--提示字符串--而您已经提供了两个。我不知道你想用[]
做什么,但你得把它删掉。
发布于 2021-03-20 10:12:17
aos
input()
不接受[]
作为第二个参数。您可以将其作为字符串从conse发送,而不是像数组一样。
发布于 2021-03-20 10:19:37
我读了你的全部代码,我想你的意思是
aos = input("Are you adding or subtracting")
answer = ['Adding','Subtracting']
然后在if语句中
if aos == answer[0]:
print("The solution is",sol1)
elif aos == answer[1]:
print("The solution is",sol2)
https://stackoverflow.com/questions/66717617
复制相似问题