Didnt we say that nothing after "return" is actually called or considered by Python? Does that apply only to "print" function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Didnt we say that nothing after "return" is actually called or considered by Python? Does that apply only to "print" function?

16th Mar 2020, 7:30 PM
sarah
sarah - avatar
5 Answers
0
No but it only applies when return is used in a function. No statement in the function after the return statement is executed
16th Mar 2020, 7:36 PM
Ore
Ore - avatar
0
But isnt this a function: Def shout(word) ? It is a function right? So then after this we have the return statement: Def shout ( word) Return ...
16th Mar 2020, 7:38 PM
sarah
sarah - avatar
0
It has to be in the function block. Like this def shout(word): return print(word) shout('hello') print('hi') Only 'hi' is printed
16th Mar 2020, 7:48 PM
Ore
Ore - avatar
0
Thank you got it!
16th Mar 2020, 7:49 PM
sarah
sarah - avatar
0
Thanks
16th Mar 2020, 8:22 PM
sarah
sarah - avatar