题解 | #N的阶乘#
N的阶乘
https://www.nowcoder.com/practice/f54d8e6de61e4efb8cce3eebfd0e0daa
def factorial(n): """计算n的阶乘""" if n == 0 or n == 1: return 1 else: return n * factorial(n - 1) # 读取多组输入,直到没有输入为止 try: while True: n = int(input()) print(factorial(n)) except EOFError: pass # 当没有更多输入时退出循环