0

Why the answer is 2?

What is the highest number this function prints if called? def pn(): print(1) print(2) return print(3) print(4) Why the answer is 2?

19th Feb 2017, 7:28 AM
ēŽ‹ę–‡ē¦
ēŽ‹ę–‡ē¦ - avatar
4 Answers
+ 4
return leaves the current function call with the expression list (or None) as return value.
19th Feb 2017, 7:39 AM
wi34rd
wi34rd - avatar
+ 1
As stated above. @ēŽ‹ę–‡ē¦, yes, that's correct.
19th Feb 2017, 11:53 PM
XYZ
XYZ - avatar
+ 1
Got it! Thank you all for answering.šŸ˜Š
20th Feb 2017, 2:41 AM
ēŽ‹ę–‡ē¦
ēŽ‹ę–‡ē¦ - avatar
0
So, if return was not here, the result would be 4?
19th Feb 2017, 11:46 AM
ēŽ‹ę–‡ē¦
ēŽ‹ę–‡ē¦ - avatar