In [1]:
#OPERATORS
#Operators are used to perform operations on variables and values.
#Python divides the operators in the following groups:
# Arithmetic operators
# Assignment operators
# Comparison operators
# Logical operators
# Identity operators
# Membership operators
# Bitwise operators
In [2]:
a= [1, 2, 3]
b= [1, 2, 3]
c=a
In [3]:
#Comparison operators (==)
#checks whether the value of a and b are equal
print(a==b)
True
In [4]:
#id prints memory address
print(id(a))
print(id(b))
print(id(c))
139632304839176
139632278608840
139632304839176
In [5]:
#identity operator (is)
#is checks whether the same object in memory
print(a is b)
False
In [6]:
print(a is c)
True
In [7]:
#False values
# Flase
# None
# zero of any numeric type
# any empty sequence. For example: '', (), [], {}