- Run Idle on your machine
python3
- Create the function cheer_1
>>> def cheer_1(team):
... print("Go " + team + "!")
...
- Run this function
cheer_1("Red Sox")
- Create a function that uses a global variable
def cheer_2():
... print("Go " + team + "!")
...
- Run this function
>>> team = "Patriots"
>>> cheer_2()
- Create a function with a default value
def cheer_3(team, times=3):
... for i in range(times):
... print("Go " + team + "!")
...
- Run this function with different function calls
>>> cheer_3("Red Sox", 5)
>>> cheer_3("Red Sox", 1)
cheer_3("Red Sox")