''' Purpose: demonstrate optional parameters ''' def test_chant() : ''' Perform simple testing of alma.chant() ''' import alma print( 'chanting with no parameters' ) print() alma.chant() # If you don't give the chant function any arguments, # it prints out Wahoo Wa three times by default. # But what happens if you DO give it arguments? print() print( 'chanting with message parameter set' ) print() # We can supply an argument to optional parameter msg (this is # saying what we want to print for the message) # So we choose the argument for msg but the second # optional parameter n's default value is still 3 alma.chant( msg='Hip hip hooray!' ) print() print( 'chanting with number of repetitions set' ) print() # In this one, the default msg is used but we supply an argument for # optional parameter n and we specify that n = 5. # So the default message Wahoo wa is now printed 5 times rather than # the default value 3 for n. alma.chant( n=5 ) print() print( 'chanting with arguments for message and repetition parameters' ) print() # In this one, we supply both arguments for optional parameters # msg and n (msg is "Wahoo wa" and n is 3 by default) but now we # are specifying that msg is 'We are CS 1112' and n is 1 alma.chant( 'We are CS 1112', 1 ) # run tester test_chant()