Python学习笔记-函数以及递归

小明子 python自学 1045 0

python中函数用def定义

注意事项别忘了冒号:

eg

def circle_area=(r):

        ...

return s

递归函数:求100!

def jiecheng(n):
   if n==1:
       return 1
   else:
       s=n*jiecheng(n-1)
   return s
print(jiecheng(
100))

Python学习笔记-函数以及递归-第1张图片-矿虫网

标签: python学习笔记

抱歉,评论功能暂时关闭!