Saturday, 21 November 2020

40. Pyhton Song

#This is to show you how to create several outputs with just one piece of code 

def lyrics0(stuff, num_repeats): #This command tells python that lyrics0 is two things:stuff and num_repeats


  return stuff*num_repeats #This means that when lyrics0 is called, it will print stuff multiplied by num_repeats


lyrics1 = lyrics0('Row ',3) + lyrics0('Your Boat. ', 1)+lyrics0('''

''', 1) #This is saying first to write three 'Row', one 'Your Boat' and one paragraph for spacing, because the script is a poem


lyrics2 = lyrics0('Gently down the stream  ', 1)+lyrics0('''

''', 1) #lyrics2, lyrics3 and lyrics4 do the same as lyrics1 but with different things to write


lyrics3 = lyrics0('Happily  ',4)+lyrics0('''

''', 1)


lyrics4 = lyrics0('Life is such a dream ', 1)


song = (lyrics1 + lyrics2 + lyrics3 + lyrics4+'''

        ''' + '''

''') #this command is saying to python: 'song is lyrics1, lyrics2, lyrics3, lyrics4 and two paragraphs all joined together


print(song*4) #As the last part, we are telling python to print song four times.

#Miguel Angel Trejo's song