When I ran the part of the assistant terminal ZeroCount (20), I got 7. When I do 20! with a calculator, it's true that there are 7 zeros, but how do I use this as a string method to get 4?
python
def terminalZerosOfFactorial(n):
fac = 1
for i in range(1, n+1):
fac *= i
s = str(fac)
cnt = 0
while s[-(cnt+1)] != "0":
cnt += 1
return cnt
def terminalZerosOfFactorial(n):
cnt = 0
for i in range(1, n+1):
while i%5 == 0:
cnt += 1
i %= 5
return cnt
597 GDB gets version error when attempting to debug with the Presense SDK (IDE)
577 PHP ssh2_scp_send fails to send files as intended
606 Uncaught (inpromise) Error on Electron: An object could not be cloned
885 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.