I need to convert negative number to binary in python. How can I do it ?
EDIT: I need to use twos complement
I need to convert negative number to binary in python. How can I do it ?
EDIT: I need to use twos complement
bin(-2)
#'-0b10'
Use the built in bin
function to get a binary representation.