'''lecture_09_birthday.py Collects user input to print the happy birthday song Oliver W. Layton Lecture 09 CS151: Computational Thinking: Visual Media Spring 2021 ''' def getHappyBirthday(): '''Returns the string: Happy birthday''' return 'Happy birthday' def getToYou(): '''Returns the string: to you''' toYou = ' to you' return toYou def getHappyBirthdayLine(): '''Assemble string: Happy birthday to you''' happyBirthdayLine = getHappyBirthday() + getToYou() # print(happyBirthdayLine) return happyBirthdayLine def getHappyBirthdayDearPerson(name): '''Assemble string: Happy birthday dear ''' return getHappyBirthday() + ' 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 ''' print(getHappyBirthdayLine()) print(getHappyBirthdayLine()) print(getHappyBirthdayDearPerson(name)) print(getHappyBirthdayLine()) # main code # # Get the name of the person whose birthday it is from the terminal # This will be a string # print(getHappyBirthdayLine()) # printHappyBirthday('Sam') birthdayPerson = input('Enter the name of a person whose birthday it is:') # print(birthdayPerson) printHappyBirthday(birthdayPerson)