'''lecture_09_birthday.py Collects user input to print the happy birthday song Oliver W. Layton Lecture 09 CS151: Computational Thinking: Visual Media Fall 2020 ''' def getHappyBirthday(): '''Returns the string: Happy birthday''' return 'Happy birthday' def getToYou(): '''Returns the string: to you''' return 'to you' def getHappyBirthdayLine(): '''Assemble string: Happy birthday to you''' # happy = getHappyBirthday() # toYou = getToYou() # return happy + ' ' + toYou return getHappyBirthday() + ' ' + getToYou() def getHappyBirthdayDearPerson(name): '''Assemble string: Happy birthday dear ''' happy = getHappyBirthday() return happy + ' dear ' + name def printHappyBirthday(name): '''Print the happy birthday song: Happy birthday to you Happy birthday to you Happy birthday dear Happy birthday to you ''' line1 = getHappyBirthdayLine() line2 = getHappyBirthdayLine() line3 = getHappyBirthdayDearPerson(name) line4 = getHappyBirthdayLine() print(line1) print(line2) print(line3) print(line4) # main code # # Get the name of the person whose birthday it is from the terminal # This will be a string birthdayPerson = input('Whose birthday is it? ') printHappyBirthday(birthdayPerson)