Bringing it all together

Introduzione alle funzioni in Python

Hugo Bowne-Anderson

Instructor

What you have learned:

  • How to write functions

    • Accept multiple parameters

    • Return multiple values

  • Up next: Functions for analyzing Twitter data

Introduzione alle funzioni in Python

Basic ingredients of a function

  • Function Header
def raise_both(value1, value2):
  • Function body
    """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
Introduzione alle funzioni in Python

Let's practice!

Introduzione alle funzioni in Python

Preparing Video For Download...