We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defflippingBits(n):# Write your code heren_to_bin=bin(n)[2:]l=len(n_to_bin)prefix=''ifl<32:foriinrange(32-l):prefix+='0'n_to_bin=prefix+n_to_binflipped=''foriinn_to_bin:ifi=='0':flipped+='1'else:flipped+='0'returnint(flipped,2)
Flipping bits
You are viewing a single comment's thread. Return to all comments →