Intro
Hello everyone sorry for the late post as you might now that I am a student so that's why I got loads of classwork to do that's why this post is late . So as you know that X-Mas / Christmas is coming close so in today's post I will be telling you how to make an X-Mas Wisher in Python.
Let's Get started !
Importing the required modules
main.py
#Making an X-Mas Wisher using python
#importing the required modules
import random
For printing the wishes we also need a file which contains wishes so first create a file named wishes.txt
Wishes.txt
Happy X-Mas
Santa Claus is coming with some exciting gifts!
Wishing you a Christmas that's merry and bright!
I hope your holiday season is full of peace, joy and happiness!
Merry Christmas with lots of love
I hope your Christmas is filled with joy this year!
May this season find you among those you love, sharing in the twin glories of generosity and gratitude.
Christmas is not an external event at all, but a piece of one’s home that one carries in one’s heart.
We clap hands and welcome the Peace of Christmas.
We beckon this good season to wait a while with us.
Christmas isn’t just a day. It’s a frame of mind.
Wishing you a season that’s merry and bright with the light of God’s love.
Christmas gives us an opportunity to pause and reflect on the important things around us.
Now we will open the file and choose a random line to print from it
#opening and reading the file
lines = open('wishes.txt').read().splitlines()
#using random to choose any random line from the file
Wish = random.choice(lines)
#printing the line
print(Wish)
Now with this done we have successfully created a X-Mas Wisher in python.
I hope you enjoyed this post.
feel free to write down your suggestions/doubts in the comments section and comment "X-Mas Yaay!" if you see this
That's it for today, stay safe and do take very good care of yourselves.
Thanks