Welcome To
Literals


Meaning

The literals in a python is fixed value and data that assigned variable then called that variable anywhere in the program
The Literals is like a constant value cannot be change during the program execution

Types

  • String literals
  • Single line string literals
  • multiLine string literals
  • Character Literals
  • Numeric Literals
  • Integer Literals
    Real literals
  • Boolean literals
  • String Literals

    The String literals in the python sequence of character that Surrounded double quotes or single quotes

    Single Line String Literals

    The single line String literals is a line os code that enclosed with double or single quotes

    Example

    sen=" This is a python learning tool"
    print(sen)


    output

    Multi Line String Literals

    The multiline String literals is a more then one line of code that enclosed with double quotes

    sen=" This is a python learning tool is created By Darshan if you want to use this app say thanks to creator "
    print(sen)


    Output


    Character Literals

    The character literals is a single character letter that assigned some fixed value that shown in the below example and that single character enclosed with single and double quotes

    Example


    code="M"
    print(code)


    Output


    Numeric Literals

    Numeric literals in python the variable can only store or assign the number or integer values . and also store the decimal point value or facractional value that shown in the real literals example

    Integer Literals

    It is a type of Numeric literals and the variable assign and store only Integer value cannot be fractional value that is shown in the below example


    x=250
    print(x)


    Output



    Real Literals

    It is a type of numeric literals . real literals means the variable store or assigned only Integer with floating point or fractional point. that is shown below


    pi=3.142
    print(pi)


    Output



    Boolean Literals

    The Boolean literals in python is variable can store or assign the boolean value that is True and False in binary value 0 and 1s this boolean value used to check the logical expressions.

    x=True
    print(x)


    Output