if I don't use function argument in python means what happens? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

if I don't use function argument in python means what happens?

7th Oct 2016, 2:28 PM
Akshay Gudadari
Akshay Gudadari - avatar
2 Answers
+ 5
Nothing. You dont have to declare a argument in a function. You can write functions without arguments. def func(): print("i have no parameter")
7th Oct 2016, 7:50 PM
Koray
+ 3
>>> def func(arg): ... print(arg) ... >>> func() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: func() takes exactly 1 argument (0 given) >>> This error is thrown for REQUIRED arguments.
7th Oct 2016, 8:23 PM
Kirk Schafer
Kirk Schafer - avatar