Oct-06-2021, 09:02 AM
Please tell me what is wrong and why it is wrong? what is wrong with indentation? please explain
Error when input() is given below def():
[attachment=1304]
Error when input() is given below def():
[attachment=1304]
def details(name,age,address): name=input("Enter your name\n") age=input('enter age\n') address=input('Enter address\n') print(f'Hello: {name}') print(f'So you are {age} old') print(f'Your address is {address}') details(name,age,address) TypeError: details() missing 3 required positional arguments: 'name', 'age', and 'address'
For above code if parameters are not given the code works def details(): name=input("Enter your name\n") age=input('enter age\n') address=input('Enter address\n') print(f'Hello: {name}') print(f'So you are {age} old') print(f'Your address is {address}') details() O/P Hello: 22 So you are 22 old Your address is 22
If parameters are given this indentation works def details(name,age,address): print(f'Hello: {name}') print(f'So you are {age} old') print(f'Your address is {address}') name=input("Enter your name\n") age=input('enter age\n') address=input('Enter address\n') details(name,age,address) O/P Hello: 22 So you are 22 old Your address is 22[attachment=1305]