First Functions
def add_five(number):
return number + 5
what_is_this_number = add_five(10) # It's a hard question but I guess 15...
print(what_is_this_number)# This function takes a string called 'message' and returns a new string
# that adds the word adios to the message
def say_goodbye(message):
return message + ' ¡Adios!'
print(say_goodbye('Hi my name is Paul!'))
# Functions you defined can call other functions as well
def add_ten(number):
with_five_more = add_five(number)
return add_five(with_five_more)
print(add_ten(10)) # You'll get 20
# We can use the output of one function as input for another
def add_ten_version2(number):
return add_five(add_five(number))
print(add_ten_version2(10)) # You'll get 20Last updated