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 Antworten
+ 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