DEV Community

loading...

Python Prowess: Day 3

ic1101virgo profile image Anjali Chaturvedi ・1 min read

I have decided to write simple C++ codes in Python 3 maybe that's the way I'll get to learn the language.

Code to calculate trailing zeros in a factorial n!

def trailingzeros(self,n):
   count=0
   i=5
   while(n/i>=1):
       count+= int(n/i)
       i*=5
   return int(count)
Enter fullscreen mode Exit fullscreen mode

🌼Please comment if you have any suggestions or encouraging words.🌼

Discussion (0)

pic
Editor guide