Variable, Literal & Operators
Variable, Literal & Operators
Comments in Python
Single Line Comments
To write a single line comment in use # symbol.
Ex : # this is the comment
What is Variable?
A variable is a name which is used to refer memory location and used to hold value.
In Python variable is also called as an identifier.
What is Literal?
Literals can be defined as a data that is given in a variable or constant.
Python Support the following literals:
String Literals
String literals can be formed by enclosing a text in the quotes. We can use both single as well as double
quotes for a string. A string literal can also span multiple lines.
Numeric Literals
Numbers stores numeric values. Python create number objects when a number is assigned to a var
variable.
Numeric literals can belong to following four different numerical types.
int (Singed integer)
float (Float is used to store floating point numbers)
complex (Complex number)
Page 1 of 3
Boolean Literals
A Boolean literal can have any of the two value: True or False
Special Literals
Python contain one special literal None. It is used to specify to that field that is not created.
Keywords
Python keywords are special reserved words which convey a special meaning to the
compiler/interpreter.
Each keyword has a special meaning and a specific operation.
Keywords cannot be used as a variable.
Page 2 of 3
Assignment Operators
• These operator are useful to store the right side value into a left side variable
• Assume a=20, y=10 and z=5
Relational Operators
• Relational operators compares the values.
• It either returns True or False according to the condition.
Page 3 of 3