-2
I’m doing a test code for python, and I’m getting the following error:
Traceback (Most recent call last): File "test.py", line 7, in g= test('Type a number: ') Typeerror: test() Missing 2 required positional Arguments: 'y' and 'z'
My way of solving this problem is only for study purposes. Basically what I want the script to do is show the questions of the variables g, h, i and save the results in a, b, c respectively. Then I want my function to return the stored values. If you can help me without altering the code structure, just so that I let it work properly.
def teste(x, y, z):
a= str(input(x))
b= str(input(y))
c= str(input(z))
return a, b, c
#Programa principal
g= teste('Digite um numero: ')
h= teste('Digite uma frase: ')
i= teste('Digite um texto: ')
teste(x=g, y=h, z=i)
print(f'{a} {b} {c}')
Without altering the structure has no way, it is wrong and makes no sense. You made the call of function 4x, and in the first three passed only one parameter while are expected 3, so the error. You could explain line by line, like a table test what your code is doing?
– Woss
Anderson, I don’t know the test table, but I found it interesting, so I’m gonna study it and put my code on top of it to see where I’m going wrong. By the way, I understood what you meant by calling 4x the function, thanks!! When I said that I did not want to change the structure of the program, I referred to not adding lines or syntaxes that I do not know, of course I want to make it functional and it will be necessary to change something in this regard
– Leandro Sargi