Literals in Python.
Literls:-
Literal is a raw data given in a variable or consatant. In python, there are various type of literls.
Type of Literls:-
String:
String is an immutable data type. String formed by enclosing a text in the qutoes. Both single and double quotes can be used.
Example:
Output:
Numeric Literls:
Numeric literals are immutable data type. Numeric literals can belong to four different Numeric type.
Types of Numeric Literls:
integer(signed integer):
Number( can be +ve and -ve) with nuber fractional part.
Example:
Long(long integer):
Integer of unlimited size followed by lower case or uppercase.
Example
Float(folating point):
Real numer with both integer and fractional part.
Example
Complex(complex):
In the form of 'a+bj' where 'a' forms the real part and 'b' form the imaginary part of complex.
Example
Boolean Literls:
A boolean literl can have two value:True or False.
Example
Output:
Special Literls:
Python has one special literls "None".
Example
Output:
Comments
Post a Comment