B
2 weeks ago
Bhumikacountry asked

Why is greeting not the output?

Sudip Bhandari
Expert
2 weeks ago

Here, greeting is a variable. When you print a variable, you get the value stored inside it as the output.
That’s why when you print greeting, you see Merry Christmas—because that's the value stored in the variable.

If you want to print the word greeting itself (not the value), you need to enclose it in quotes, like this:

print("greeting")

In this case, "greeting" is treated as a string, not a variable. So the output will simply be:

greeting

Quick reminder:

  • Without quotes → Python treats it as a variable and shows its value.

  • With quotes → Python treats it as plain text (a string).

Hope this clears things up! Let me know if you have any other questions.

Python
This question was asked as part of the Learn Python Basics course.