Python Forum
understanding exponential and bitwise operators - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: understanding exponential and bitwise operators (/thread-19153.html)



understanding exponential and bitwise operators - srm - Jun-15-2019

Hi there,
I am new to python and would like to understand working of few expressions related to operators in python.
example :
a = 21
b = 10
c = 0

c **= a 
c //= a 

Output:
2097152
Output:
99864
a=60
b=13
c=0
c = a<< 2
c=a >> 2 

Output:
240
Output:
15
how these above expressions are evaluated ,bit confused in bitwise operators..
Thank you in advance


RE: understanding exponential and bitwise operators - ThomasL - Jun-15-2019

You may want to have a look here
Your example output for c **= a cannot be 2097152 if c is zero.
It would be correct if c is 2.