+ 1
Assign function as variable
Sorry. This is a quiz on python by Sololearn. I don't understand why assigning a function to a variable calls it! Could anyone give me an explanation? Thanks https://code.sololearn.com/cHnws7ACA4f1/?ref=app
6 odpowiedzi
+ 3
A function basically performs a specific task (most times returning a value)
Parathenses '()' are used for calling the function and that returned value could be simply printed or even stored in a variable
PS: You could even try assigning the function to a variable without the parentheses and in this case it returns the memory-location
+ 2
Pariket Thakur As far as I know, the expression "A===B" means nothing because the "===" operand does not exist in python! The same for "null", which doesn't exist in python (you can use "None").