In [ ]:
first_name = "Zaphod"
def hello(name):
"""Say hello"""
print "Hello, {}".format(name)
def hello_multi(name, greeting_mult=1):
"""Say hello gratuitously"""
greeting_count = 3 * greeting_mult
for num in range(greeting_count):
hello(name)
In [ ]:
hello(first_name)
In [ ]:
hello_multi(first_name, 3)
In [ ]:
# optional arguments
hello_multi(first_name)
In [ ]:
# keyword arguments
hello_multi(first_name, greeting_mult=2)
In [ ]:
%xmode plain
# fail, missing required argument
hello_multi(greeting_mult=2)