Variables, Data Types, Operators in Python
Variables, Data Types, Operators in Python
PYTHON
c=3 b 3
type( )
Output:
Sum : 5
Difference : 1
Product : 6
Datec Learning Centers
Arithmetic Operators
Example:
number1 = 8
number2 = 3
#Performing modulo division
remainder=number1%number2
print(“Remainder : ”, remainder)
Output:
Remainder : 2
Output:
Quotient : 2
Operator Used:
=
Assigning values to Variables
variablename = value
Example:
marks=93
Example:
Example:
Output:
17
Operator Operation
== Equal
!= Not Equal
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
Output:
True
False
Operator Outcome
and Returns True, if both statements are true
or Returns True, if one of the statements is true
not Reverse the result, returns False if the result is true
Output:
True
True
False
Datec Learning Centers
Identity Operators
▪ Used to compare the objects
▪ To check if they are actually the same object, with the same
memory location
Operator Outcome
Operator Outcome
Returns True ,if a sequence with the specified value is
in present in the object
Output:
-3
-5
Output:
6