Python literals
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 -
- Number litrals
- Int ( Intiger )
- Float
- Complex
- Boolean
- String litrals
- Spacial litrals
- Number litrals :-
- Int ( intiger ) :-
- Float :-
- Complex :-
- Boolean litrals :-
- String litrals :-
- Special litrals :-
Number literals can be defined in three types in Python.
Intiger can define both positive and nigative.
Float can define number with desimal float are also positive or nigative.
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 |
---|
Boolean litrals can be either 0 or 1, Either true or false.
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 ( """_ _ _ _ _ _""" ).
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
Post a Comment