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
>>>
>>>
You have made big error, by not noticing the function call of power function in line 6.
ReplyDeleteCorrect answer is:
1-5-9-10-5-6-1-2-3-6-7-10-11
Sorry , I have correct it .
DeleteYou missed a 6 before 7(third last place) as compiler will read it again to assign the value in "a" present in 6th line.
ReplyDeleteOk.
DeleteWhere is the output??Please tell
ReplyDeleteOk, I have read it.
DeleteOutput will be 52
ReplyDeleteYou are worng, Please run the program in your IDLE Python.
Deletewill it not directly execuse from __main__ why is def included?? its not in flow of execution
ReplyDeletei mean execute
DeleteI did not understant what you want to say, Please tell me again.
DeleteBut, even blank line will be executed right?
ReplyDeleteNo, bro.
Deleteis answer 25?
ReplyDeleteI didn't get it's solution please give a brief explanation...
ReplyDeleteyou fool of an ass
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )