Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
exclusive bitwise OR
#1
Hi

Am using 3.6.5
I'm trying to display the result of a bitwise operation, like so:
xor = 0b0011 ^ 0b0111
print ("Example of exclusive OR - xor = 0b0011 ^ 0b0111: ".format(bin(xor)))
But nothing appears.

$ ./test_bw_or.py 
Example of exclusive OR - xor = 0b0011 ^ 0b0111: 
Can somebody help?
Reply
#2
Hi, you are missing {}, where format will place the calculated value:
print ("Example of exclusive OR - xor = 0b0011 ^ 0b0111: {}".format(bin(xor)))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  bitwise rotation/classes msp1981 1 2,450 May-06-2019, 10:15 PM
Last Post: michalmonday

Forum Jump:

User Panel Messages

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