Q. Predict the output of following code:
num = 20.5
z = 3
result = 2 + z * z ** 3 + num // z
print (result)
(a) Firstly, determine the answer without running the code and write.
(b) Now type the above code in script mode and test-run the program. Write below the result given by Python.
Answer =
(i)
It is based on your thinking that how you execute the above program in your mind. So do you self.
(ii)
Output:-
89.0
>>>
i dint know if it is a printing mistake but in my textbook, in the question the code was as follows :-
ReplyDeletenum = 20.5
z = 3
result = 2 + z * z ** 3 + num // z
print (result1)
so technically the answer for both paprts would be ERROR: result 1 is not defined.
could you please do me a favour and checck the question once again the textbook and confirm?
Thnak you. Appreciate all the answers 😊.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )