python基础题目100例之二十五
- 求1+2!+3!+…+20!的和。
def jiecheng(num):
mul =1
while num !=1:
mul*= num
num-=1
return mul
sum=0
for i in range(1,21):
sum += jiecheng(i)
print(sum)
标签:03,21,04,sum,num,2021,mul,jiecheng
来源: https://blog.csdn.net/huzhenglomg/article/details/115421059