def printcake():
    print cake #This function prints the taste of cake when called
def setcake(taste, printq):
    global cake #This makes sure that cake can be called in any function
    cake = taste #sets cake's taste
    if printq: #determines whether to print the taste
        printcake() 
setcake('good', True) #Calls the function to set cake. Tells it to print result. The output is good