# !/usr/bin/python3 # -*- coding: utf-8 -*- """ @Author : JHC @Version : ------------------------------------ @File : Scrapy/test01.py @Description : JHC @CreateTime : 2021/12/20 21:11 ------------------------------------ @ModifyTime : """ def jiecheng(n): count = 0 sum = 1 num = n+1 lis = list(range(1,num)) for i in lis: sum *= i while sum%10 == 0: count += 1 sum /= 10 sum%=10 print(count) def jiecheng2(n): from functools import reduce num = n+1 sum = reduce(lambda x,y:x*y,range(1,num)) print(sum) if __name__ == '__main__': n=input('请输入要计算的数;') jiecheng(int(n)) jiecheng2(int(n))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)