Answer to Question #247427 in Python for Isabel Cortez

Question #247427

3. The Last 'Zeroes'


How many zeroes are there after the last non-zero digit of a million? A trillion? To easily identify that, let us make a program to count and print the number of zeroes after the last non-zero digit on a number. For example, in 20400, there are 2 zeroes after the last non-zero digit of the number, 4.


Are you up for this challenge?


Input

A line containing an integer.


20400


Output

A line containing an integer.


2


1
Expert's answer
2021-10-06T06:17:47-0400
def last_zeros(num):
        new_num = str(num)
        count = len(new_num) - len(new_num.rstrip("0"))
        return count


N=int(input("Enter an interger: "))
print(last_zeros(N)) 

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

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS