[Python急救站课程]计算1!+2!+3!+......+10!
计算1!+2!+3!+......+10!程序
sum, tmp = 0, 1
for i in range(1, 11):
tmp *= i
sum += tmp
print("运算结果是: {}".format(sum))
程序运行结果如下:
计算1!+2!+3!+......+10!程序
sum, tmp = 0, 1
for i in range(1, 11):
tmp *= i
sum += tmp
print("运算结果是: {}".format(sum))
程序运行结果如下: