""" Purpose: demonstrate the end optional parameter for print() """ # normal printing print( "Wa-Hoo-Wa" ) print( "Rah-Rah-Rah" ) print(); input( "Enter when ready: " ) ; print()# you don't use ; in this course... CS degrees only! # introduce end parameter print( "Wa-Hoo-Wa", end="!" ) # imagine print() statements with an invisible end="\n" , so we go to a new line print( "Rah-Rah-Rah" ) # by default. end= is exclusive to the print() function # when python invokes functions ( when we put parentheses! ) only what is in the parentheses is passed on to # the function. end= needs to be in the parentheses of the print() statement. # end is a special print() function variable, not a keyword print(); input( "Enter when ready: " ) ; print() # loop through FINNISH_SELLER_OF_LYE the longest palindrome - each letter # has a trailing - FINNISH_SELLER_OF_LYE = "saippuakivikauppias" # constants are defined in uppercase SNAKE_CASE # all caps says i will never ever change this value for ch in FINNISH_SELLER_OF_LYE : print( ch, end="-" ) print( "." ) # this will still be on the same line and will start a new line after print(); input( "Enter when ready: " ) ; print() # loop through FINNISH_SELLER_OF_LYE the longest palindrome - each letter # has a trailing space for ch in FINNISH_SELLER_OF_LYE : print( ch, end=" " ) print( "." ) print(); input( "Enter when ready: " ) ; print() # loop through FINNISH_SELLER_OF_LYE the longest palindrome - each letter # has nothing trailing space for ch in FINNISH_SELLER_OF_LYE : print( ch, end="" ) # we can print things in for loops and have all of them on the same line! yay! print( "." )