Updated: a day ago
Suppose it's your birthday and you need to create an invitation. Let's see how we can do that using the python function.
In this program, we will learn to create reusable code with functions and make personalised invitation cards using function parameters. We will be using concepts as indicated in the concepts covered.
If you wish to learn the concepts and see the detailed steps to arrive at the solution, refer to my video on youtube
python function, parameters, default parameter values, f-string, multiline string with triple quotes, for with list, string split
The program should create a personalised invitation message for 5 different persons with the following message
Dear <guestname>, Please come to my birthday party Venue-<venue name> Date-<date of birthday> Time-<time of party> Host Name
How It Should Work
Create a function birthdayInvite which accepts parameters - guestName, venue,day,time,hostName
Give default value to parameters like venue,day,time,hostName
Inside the function, use triple quotes and f-string to create an invite message using params
Outside the function prompt user to enter guest names separated by a comma & save it in a string
Create a guest list by splitting the above string taken from the user
Use for loop to create invitation card by calling the function.