标签: python
为什么不打印阶乘?
calendar-template.html.twig
答案 0 :(得分:2)
chepner noted in a comment:您正在打印而不是返回最终结果
def fac(n): result = 1 while n != 1: result = result * n n = n-1 return result print(fac(4))