0

plz explain me why things happen like that in these 4 cases:

1) def lust(no): return no + 69 return no - 69 print(lust(45)) doesnt give me value of no-69 2) def lust(no): return no + 69 return no - 69 lust(45) doesnt give any value 3) def lust(no): print(no + 69) print(no - 69) print(lust(45)) gives none at last 4) def lust(no): return no + 69 print(no - 69) print(lust(45)) gives only 114

13th Dec 2019, 8:00 PM
PRO
PRO - avatar
4 Answers
+ 1
1) After function call, the first return statmend returns no+69. That's it. The second return will never reached.
13th Dec 2019, 9:51 PM
Coding Cat
Coding Cat - avatar
0
2) this is without any print statemend. You will see nothing.
13th Dec 2019, 9:53 PM
Coding Cat
Coding Cat - avatar
0
3) Is a function without a return statemend. Python functions will then return "None" by default.
13th Dec 2019, 9:56 PM
Coding Cat
Coding Cat - avatar
0
4) Same as in 1). After First return statemend the function ends. The print statemend will never reached.
13th Dec 2019, 9:59 PM
Coding Cat
Coding Cat - avatar