总结所学

Python 函数入门

Hugo Bowne-Anderson

Instructor

您已学到:

  • 如何编写函数

    • 接受多个参数

    • 返回多个值

  • 接下来:用于分析 Twitter 数据的函数

Python 函数入门

函数的基本要素

  • 函数头
def raise_both(value1, value2):
  • 函数体
    """Raise value1 to the power of value2
    and vice versa."""

    new_value1 = value1 ** value2          
    new_value2 = value2 ** value1

    new_tuple = (new_value1, new_value2)

    return new_tuple
Python 函数入门

开始练习!

Python 函数入门

Preparing Video For Download...