标签:阶乘 color sum else lse col val n+1 int
def main(): a = input() sum = 0 if a.isdigit(): n = eval(a) if n > 0: fact = 1 for i in range(1, n+1): fact *= i sum += fact print(sum) else: print("输入有误,请输入正整数") else: print("输入有误,请输入正整数") main()
标签:阶乘 color sum else lse col val n+1 int
原文地址:https://www.cnblogs.com/xxt77/p/12701545.html