print (print (print (5))) | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 4

print (print (print (5)))

Which 'print ' function is executed first in the following code and why ?: https://code.sololearn.com/cx6qnbvfiLwo/?ref=app

9th Apr 2020, 1:47 AM
Ayush Dwivedi
Ayush Dwivedi - avatar
3 Antworten
+ 3
The first print() call (the outer most call) needs something as argument to be printed, for that, the second print() call needs to be processed first. But the second print() call also needs something as argument to be printed, and for that, the third print() call (the inner most call) needs to be processed first. * Remember print() returns a None object.
9th Apr 2020, 3:49 AM
Ipang
+ 3
Nested function calls starts from inner most call to the outer most call. print ('third',print('second',print ('first',5)))
9th Apr 2020, 2:26 AM
Ipang
+ 2
Reason please... ipang
9th Apr 2020, 2:29 AM
Ayush Dwivedi
Ayush Dwivedi - avatar