Answer to Question #79825 in Python for Renu Singh

Question #79825
What does g(31415927)return for the following definition?
def g(x):
(q,d) = (1,0)
while q <= x:
(q,d) = (q*10,d+1)
return(d)
1
Expert's answer
2018-08-15T09:07:08-0400
# -*- coding: utf-8 -*-
"""
Answer: 8
"""

#What does g(31415927) return, for the following function definition?
def g(x):
(q,d) = (1,0)
while q <= x:
(q,d) = (q*10,d+1)
return(d)

print(g(31415927))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
20.08.18, 12:38

Dear Rajat, Questions in this section are answered for free. We can't fulfill them all and there is no guarantee of answering certain question but we are doing our best. And if answer is published it means it was attentively checked by experts. You can try it yourself by publishing your question. Although if you have serious assignment that requires large amount of work and hence cannot be done for free you can submit it as assignment and our experts will surely assist you.

rajat
17.08.18, 22:51

can u explain this program

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS