Input expected at most 1 arguments, got 3

匿名 (未验证) 提交于 2019-12-03 02:44:02

问题:

Can someone please help? I just started and it's not working:

myName = input("Hi, what is your name?") myVar = input("Hello", myName,", how are you?")  if(myVar == "Good"):     print("That's good!")  if(myVar == "Bad"):     print ("Oh well") 

回答1:

Here is your problem:

input("Hello", myName,", how are you?") 

The input function takes only one argument, the prompt. Here you are passing three. Python doesn't know what to do with the other two.

Pass one argument instead:

input("Hello " + myname + ", how are you?") 


回答2:

maybe this solves your problem

myVar = input("Hello"+ myName + "how are you?")



回答3:

You need to make it into one argument instead of 3.Try this. i have had a similar error before and this did the trick!

myVar = input("Hello" + myName + "how are you") 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!