Lab 2: Nested Function Call Exercises

Do these exercises on the whiteboard with your partner(s).

Exercise Nested 1

def h(s):
    return '##' + s.lower()

def q(s):
    return s.upper() + '?'

Answer the following questions for the functions h and q defined above:

Exercise Nested 2

def z():
    """ zero """
    return 0

def d(n):
    """ double """
    return 2*n

def i(n):
    """ double and increment """
    return 2*n + 1

Answer the following questions for the functions z, d, and i defined above:

Table of Contents