Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

This function throws an error at the input function claiming that the arguments are invalid.. any resolutions?

def assignSquareValues():
        square=[[0,0,0],
                [0,0,0],
                [0,0,0]]
        count=0
        try:
            for r in range(3):
                for c in range(3):
                    count+=1
                    print(count)
                    square[r][c]= int(input(("Enter a number(1-9) for square #",(count)+":",sep=''))) #this line throws an error stating that "TypeError: input expected at most 1 arguments, got 2"

        except Exception as err:
            print(err)
            assignSquareValues()

        checkMagicSquare(square)
share|improve this question
    
How are you calling the method? What is your exact error message? Please show the full traceback. – idjaw 20 hours ago
    
Traceback (most recent call last): File "C:/Users/alec/Desktop/loShuMagicSquare.py", line 46, in <module> assignSquareValues() File "C:/Users/alec/Desktop/loShuMagicSquare.py", line 39, in assignSquareValues square[r][c]= int(input("Enter a number(1-9) for square #",(count)))#,":",sep=""))) TypeError: input expected at most 1 arguments, got 2 – Alec Medina 20 hours ago
    
This is the error that i get.. – Alec Medina 20 hours ago
    
actually after i added () around the arguments its just saying the separator argument is invalid syntax but i dont see anything wrong – Alec Medina 20 hours ago
    
That line is not correct. Can you please explain what it is you are trying to do? Explain what your code is supposed to do, explain what the line you are pointing to is supposed to do – idjaw 20 hours ago

input() expects one argument - displayed text - so you have to concatenate all arguments in to one text

ie.

input("Enter a number(1-9) for square #" + str(count) + ":")

or

input("Enter a number(1-9) for square #{}:".format(count))
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.