+ 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

1st Mar 2022, 2:10 PM
Raffaele Bisogno
Raffaele Bisogno - avatar
6 Respostas
+ 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
2nd Mar 2022, 1:52 PM
Pythøñ Cúltîst⚔️🔥🇳🇬
Pythøñ  Cúltîst⚔️🔥🇳🇬 - avatar
+ 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").
1st Mar 2022, 2:37 PM
Raffaele Bisogno
Raffaele Bisogno - avatar
1st Mar 2022, 2:27 PM
Raffaele Bisogno
Raffaele Bisogno - avatar