What Is Literal ? Python Literal in Details

 Python Literals

What is Literal?

Answer: A literal is a data whose values are determined by the literal itself.

Demonstration for Literal as below:


Look at the following set of digits:

123

Can you guess what value it represents? 

Of course, you can say - it's one hundred twenty-three.

But what about this:

Does it represent any value? Maybe. It can be the symbol of the speed of light, for example. It also can be a constant of integration. Or even the length of a hypotenuse in the sense of a Pythagorean theorem. There are many possibilities.

You cannot choose the right one without some additional knowledge.

And this is the clue: 123 is literal, and c is not.

You use literals to encode data and to put them into your code. We're now going to show you some conventions you must obey when using Python.


Comments