Python literals

Python variables .

Python Variable :-

In python variable and identifire are same.

Variable are containers for storing data values.

Python has no command for declearing a variable

Variable Name :-

  • A variable name must start with a letter or the underscore carrecter.
  • Variable name can't start with a number.
  • A variable name can only contain alpha numeric carrectors and under score
    ( a-z,0-9 and _ ).
  • Variable name are case sensitive.
  • Variable name can't be any if the python key words.

Python litrals :-

Python literals are the smallest unit to store a value inside a variable which are of
the following types -

  1. Number litrals
    1. Int ( Intiger )
    2. Float
    3. Complex
  2. Boolean
  3. String litrals
  4. Spacial litrals
  1. Number litrals :-
  2. Number literals can be defined in three types in Python.

    1. Int ( intiger ) :-
    2. Intiger can define both positive and nigative.

    3. Float :-
    4. Float can define number with desimal float are also positive or nigative.

    5. Complex :-
    6. Complex number are the number having both real and imaginary part in the form of
      (x + yj).Along with the x is real and y is imaginary.

      Example :- 2 + 2j
      real + imaginary
  3. Boolean litrals :-
  4. Boolean litrals can be either 0 or 1, Either true or false.

  5. String litrals :-
  6. String litrals are define a word or a carrector or sentense . String litrals quated
    with single inverted quma (') or doble inverted quma ("),single line (-) multiple
    multiple line string define with ( '''_ _ _ _ _ _ _''' ) or ( """_ _ _ _ _ _""" ).

  7. Special litrals :-
  8. Name is a spacial defined in python to specity the end of a list or to represent a NULL value

Litrals Collection:-

Besic lists python supports tuples and dictionary to store a collection of litrals in single variable.

Comments

Popular posts from this blog

javascript

Python Operators