Binary
JustineHoresh

Hello folks. I need a python program that is converting a number in binary like 2=10.
Thanks in advance for your help and sorry for my broken english

You are viewing a single comment. View All
finleyparr

num = int(input('Input number between 0 and 255 and I will convert it into binary.'))
if num < 256:
print(bin(num))

this code it quite short but it has an annoying 0b at the start and i dont know how to remove it, but as long as you can ignore it or can remove it yourself, feel free to use it, it took me a couple minutes to make

PabloJuan

@finleyparr
bin(int(x)).split('0b')[1]