Python Forum
understanding exponential and bitwise operators
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
understanding exponential and bitwise operators
#1
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
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Use of if - and operators Pedro_Castillo 1 459 Oct-24-2023, 08:33 AM
Last Post: deanhystad
  Mixing Boolean and comparison operators Mark17 3 1,372 Jul-11-2022, 02:20 AM
Last Post: perfringo
  how to get non-exponential format Skaperen 1 1,416 Nov-21-2021, 08:51 PM
Last Post: bowlofred
  Program demonstrates operations of bitwise operators without using bitwise operations ShawnYang 2 1,757 Aug-18-2021, 03:06 PM
Last Post: deanhystad
  Bitwise ~ Operator muzikman 10 3,828 Feb-07-2021, 04:07 PM
Last Post: muzikman
  Magic Method Arithmetic Operators ClownPrinceOfCrime 3 2,281 Jan-10-2021, 03:24 PM
Last Post: ndc85430
  Bitwise Slicing Peter_Truman 6 3,473 Aug-25-2020, 06:41 AM
Last Post: Peter_Truman
  Class and Operators in Python rsherry8 1 1,958 May-27-2020, 07:09 PM
Last Post: buran
  Trying Comparison Operators PythonGainz 3 2,671 Mar-28-2020, 10:46 AM
Last Post: PythonGainz
  Mathematical Operators in String AgileAVS 1 2,345 Mar-04-2020, 04:14 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020