点击此处浏览总目录

位置参数

位置参数

  定义位置参数函数

    def power(x, n): #函数有两个参数:x和n,这两个参数都是位置参数,调用函数时,传入的两个值按照位置顺序依次赋给参数x和n
      s = 1
      while n > 0:
        n = n - 1
        s = s * x
      return s

 

 

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

posted @ 2019-05-22 15:14  立业的博客  阅读(392)  评论(0编辑  收藏  举报