Djtiamme
asked

Expert
Kelish Rai answered
It seems there’s a slight confusion about what you're trying to achieve.
Firstly, "greeting" = "Merry Christmas" is incorrect, as you don’t need to enclose variables within quotation marks. The correct syntax would be:
greeting = "Merry Christmas"This way, greeting is correctly defined as a variable. Whereas Python would treat "greeting" as a string instead.
Similarly, the line print("greeting") won’t print "Merry Christmas" because of the quotation marks.
To correctly print the value of the greeting variable, you should write:
print(greeting)This will output "Merry Christmas" as expected.
Note: Think of variables as "labels" for values. If you wrap the label in quotes, Python thinks it's just a word, not a label pointing to something else.
Python
This question was asked as part of the Getting started with Python course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer