''' Purpose: demonstrate optional parameters with some testing of alma.chant() ''' import alma print( 'chanting with no parameters' ) print() alma.chant() # we give no arguments here, so the default msg ( "Wahoo Wah" ) and n ( 3 ) will be used print() print( 'chanting with message parameter set' ) print() alma.chant( msg='Hip hip hooray!' ) # we change the msg to "Hip hip hooray!" but n has not been given, so is 3 # when we change the msg or n argument from the default value, we need to tell Python which variable we're # changing. so we use the names as defined in the function definition msg and n print() print( 'chanting with number of repetitions set' ) print() alma.chant( n=5 ) # we change n to 5 and the default msg is used print() print( 'chanting with arguments for message and repetition parameters' ) print() alma.chant( 'We are CS 1112', 1 ) # here we change the msg and the n, so neither of the default values are used