Q. Trace the following code and predict the output produced by it


1. def power (b, p):

2. y = b ** P

3. return y

4.

5. diff calcsquare (x) :

6. a = power (x, 2)

7. return a

8.

9. n = 5

10. result = calcsquare (n) + power (3,3)

11. print (result)


Answer =

Flow of execution for the above code will be:

1->5 ->9 ->10 ->6->2 ->3-7->2->3 ->11

The output produced by the above code will be:
52

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post