1 def f(x): 2 if x == 0: 3 return 0 4 elif x == 1: 5 return 1 6 else: 7 return (x * f(x - 1)) 8 while 1: 9 info = int(input('>>>:')) 10 print(f(info)) 11 print('还想试试吗?(输入no退出)') 12 info = input('>>>:') 13 if info == 'no': 14 break 15 info1 = int(info) 16 print(f(info1))
来源:https://www.cnblogs.com/reaix/p/12651191.html