"Review: Functions"



def shut_down(s = "yes"):
    return "shutting down"
elif shut_down(s = "no"):
    return "shutdwon aborted"
    return "sorry"

 My code doesn't run correctly.  Please advise.


Ian Michael Jones


s a variable inside the function, look:

def test_function(s):
    print s
test_function("hello world")

When i call the function, i determine what the value is that s will hold. Knowing this, we can simple do:

def shut_down(s):
   if s == "yes":
      /* do something */

remember to use two equal signs to compare, one equal sign is used for assigning a value to a variable

 Thanks for all of your help! I really do appreciate it! Take care!


Ian Michael Jones