TypeError: input expected at most 1 arguments, got 3

前端 未结 1 1234
情话喂你
情话喂你 2020-12-06 21:54

I\'m making a small guessing game in Python where the computer guesses a number chosen by the player. I\'m getting an error when I try to ask for user input:



        
相关标签:
1条回答
  • 2020-12-06 22:40

    input only accepts one argument, you are passing it 3. You need to use string formatting or concatenation to make it one argument:

    answer = input("Is it {} ?".format(guess))
    

    You were confusing this with the print() function, which does indeed take more than one argument and will concatenate the values into one string for you.

    0 讨论(0)
提交回复
热议问题