I am using below code for calculating trailing zeroes. It passes sample inputs, but it fails testcases. Can someone please point out the mistake in the code, so that I do not repeat it.
t = int(input())
#taking input for number of test cases
for i in range(t):
n = int(input())
i = 1
lis = []
while 5**i < n:
lis.append((n//(5**i)))
i += 1
print(sum(lis))
Following was sample input: 6 3 60 100 1024 23456 8735373
And it did return correct answers.
I have now realised what I had done wrong, in line 7, I wrote while 5**i < n: instead I shoud have wrote while 5**i <= n:
Only test cases where above code fails are 5^i. This was my first question on stack overful, I am quite delighted by helpfulness of the community.