I have a string with the value '0101', it is a binary number. I wish to add one bit to it in order to obtain '0110'. Is someone able to help me accomplish this in my python program.
bit_s = '1010'
inverse_s = '' #add one bit
#two_s = '' two's comp
for i in bit_s:
if i == '0':
inverse_s += '1'
else:
inverse_s += '0'
print("Inversed string is ",
inverse_s) #tried + '1' bad output
