Operators and Operands
Link will be apear in 15 seconds.
Well done! you have successfully gained access to Decrypted Link.
Operators
and Operands:
• Operators
are special symbols that represent computations like addition and
multiplication.
• The
values the operator uses are called operands
• When
both of the operands are integers, the result must also be an integer, and by
convention, integer division always rounds down.
• +,
-, *, /, %, **,//
• **
is used for exponential.
• / is
also used for float division
• //
is used to integer division
• >>>
2/3
• 0.6666666666666666
• >>>
2.0/3
• 0.6666666666666666
• >>>
2.0/3.0
• 0.6666666666666666
A
very Interesting question in python:
What is the maximum possible value of an integer in
Python ?
In Python, value of an integer is not
restricted by the number of bits and can expand to the limit of the available
memory.
>>> x=10000000000000000000000000000
>>> x
10000000000000000000000000000
As a side note, in Python 3, there is only one type “int”
for all type of integers. In Python 2.7. there are two separate types “int”
(which is 32 bit) and “long int” that is same as “int” of Python 3.x, i.e., can
store arbitrarily large numbers.
• x = 10
• print(type(x))
• x =
10000000000000000000000000000000000000000000
• print(type(x))
• Output
in Python 2.7 :
• <type
'int'>
• <type
'long'>
• Output
in Python 3 :
• <type
'int'>
• <type
'int'>