描述:
给你一个正整数列表 L, 输出L内所有数字的乘积末尾0的个数。
例如: L=[2,8,3,50],
则输出:2
Python代码:
from functools import reduce L = [2, 8, 3, 50, 3, 2] count = 0 def mul(x, y): return x * y mu = reduce(mul, L) mu2str = str(mu) for i in mu2str[-1:: -1]: if i == '0': count += 1 else: break print(count)