ICode9

精准搜索请尝试: 精确搜索
  • 12_迭代和递归2022-08-05 09:02:32

    求一个数的阶乘 # 迭代方法实现 def factIter(n): result = n for i in range(1, n): result *= i return result print(factIter(10)) # 递归方法实现 def funC(n): if n == 1: return 1 else: return n * funC(n-1) print(funC(1

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有