Literals are data items that have a fixed value. 

Python has the following 4 literals:

1. String literals : the text enclosed in quotes  (single or double) is considered to be a string  literal.

Examples:

    • “abc”
    • ‘d’
    • “123start”

2. Numeric literals: Numeric literals can be of type int, float or complex.

Examples:

  • 10
  • 3.1497
  • 2+3i

3. Boolean literals: It represents one of  the two Boolean values.

Examples:

    • True
    • False

  4. Special literals: None is a special literal that  indicates absence of a value and is generally  used to indicate end of lists in python. It  means that there is no useful information.

Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.