Q. Consider the following code and write the flow of execution for this. Line numbers have been given for your reference.
def power (b, p): # 1 y = b ** p # 2 return y # 3 # 4 def calcSquare(x): # 5 a = power (x, 2) # 6 return a # 7 # 8 n = 5 # 9 result = calcSquare(n) # 10 print (result) # 11
Answer :-
1->5->9->10->5->6->1->2->3->6->7->10->11
Output :-
25
>>>
>>>
the answer is not very clear
ReplyDeleteAt first you have to study about flow of execution then you will able to understand.
DeleteThe answer is clearly wrong, we also have to go the 1st function after entering 5 and then after 6 it should be 1 again, the answer is wrong update it
ReplyDeleteSorry 😔. I have corrected it.
Deletevery nice
ReplyDeleteThank you : )
DeleteReally appreciate it :)
ReplyDeleteThank you so much 🥰💞
DeleteAfter 6 it will directly go to 7
ReplyDeleteSorry after 3 it should be direct 7
DeleteNo, You are wrong.
DeleteThankyou
ReplyDeleteWelcome : )
Deletethank youuu
ReplyDeleteWelcome : )
DeleteCan you explain the reason behind the flow and why it is going on line 1 after 6
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )