You are currently viewing Best christmas greetings using python code
christmas python code for 2021

Best christmas greetings using python code

Spread the love

In this article we will see how to write simple python code to wishing to someone for this merry christmas in 2021.

So Let’s see:

we use three Random wishing quits, when we run this program we got different random output at each time

Merry Christmas in python


import random
NUMBER_OF_TEMPLATES = 3
def ChooseWord(wordlist) :
	word = random.choice(wordlist)
	wordlist.remove(word)
	return word
def PickRandomNumber(ns) :
	n = random.choice(ns)
	ns.remove(n)
	return n

def IWishYou(second, third) :
	noun = ChooseWord(third)
	adjective = ChooseWord(second)
	print("I wish you a " + adjective + " " + noun + ".")


def IHopeTo(fourth, fifth) :
	verb = ChooseWord(fourth)
	adverb = ChooseWord(fifth)
	print("I hope " + verb + " you " + adverb + ".")

def HaveA(second, third) :
	adjective = ChooseWord(second)
	noun = ChooseWord(third)
	print("Have a " + adjective + " " + noun + ".")

def Salutation(first) :
	salutation = ChooseWord(first)
	print()
	print(salutation + "!")

	
def SignOff(endings) :
	end = ChooseWord(endings);
	print(end);
	print("END");


def GenerateChristmasGreeting() :  
	first =  ["Happy Christmas from sach", "Merry Christmas from educational", "Season's Greetings from support", "Happy New Year in advanced from sachin"]
	second=  ["wonderful", "joyous", "peaceful"]
	third =  ["few weeks", "christmas"]
	fourth=  ["to be with", "to meet up with"]
	fifth =  ["soon", "in the new year"]
	endings= ["love with you","All my love"]
	
	Salutation(first)
	
	templatesleft = list(range(0,NUMBER_OF_TEMPLATES))
	
	while len(templatesleft)>0 :
		sentencechoice = PickRandomNumber(templatesleft)
		if (sentencechoice == 0) :
			IWishYou(second, third)
		elif (sentencechoice == 1) :
			IHopeTo(fourth, fifth)
		elif (sentencechoice == 2) :
			HaveA(second, third)
		else :
			print("I'm lost for words")
        
	SignOff(endings)

GenerateChristmasGreeting() 

Output

This below window appear after running this code

christmas code in python
Christmas in python
Christmas image in python
Christmas image in python

sachin Pagar

I am Mr. Sachin pagar Embedded software engineer, the founder of Sach Educational Support(Pythonslearning), a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Leave a Reply