'''
计算 1! + 2! + 3! + ... + 10! 的结果
@Ref 2017.Python语言程序设计基础.第2版.嵩天, p29
@Version: v0.1, Python 3.9.5, Notus(hehe_xiao@qq.com), 2021.05.25
@Updated: 2021.05.25
'''
sum, tmp = 0, 1
for i in range(1, 11):
tmp *= i
sum += tmp
print("运算结果是: {}".format(sum))
运行结果
运算结果是: 4037913