Python Print Birthday Poem Program

By | March 21, 2020

Python Print Birthday Poem Program for printing the popular happy birthday poem to a specific person.

This Python program uses a user defined function print_birthday_poem(person_name). This function takes a person name as parameter and prints happy birthday poem for him / her.

The main function will ask the input that is the birthday person’s name. This name is passed to the user defined function print_birthday_poem(person_name) for printing the birthday song / poem.

# Python Program to print happy birthday
# poem to a person whose name is passes as
# parameter to user defined function

# www.EasycodeBook.com

# define user defined function
def print_birthday_poem(birthday_person):
    """ Prints happy birthday poem for the birthday person"""

    print("Happy Birthday to you!")
    print("Happy Birthday to you!")
    print("Happy Birthday, dear " + birthday_person + ".")
    print("Happy Birthday to you!")

# define main function
def main():
    person_name = input("Enter the Birthday person's name: ")
    print_birthday_poem(person_name)

# call the main() function
main()

Output

Enter the Birthday person's name: Jameel Jami
Happy Birthday to you!
Happy Birthday to you!
Happy Birthday, dear Jameel Jami.
Happy Birthday to you!

--------------------
You will also like:
Python User Defined and Built-in Functions – Defining and Using Functions

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *