Justine Horesh
@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
PranshulMankad Decimal To Binary:
print("Converting Decimal Numbers To Binary\n\n")
a=int(input("Enter The Number: "))
b=a%2
print(b)
c=(a//2)%2
print(c)
d=(a//4)%2
print(d)
e=(a//8)%2
print(e)
f=(a//16)%2
print(f)
g=(a//32)%2
print(g)
h=(a//64)%2
print(h)
i=(a//128)%2
print(i)
print("The binary number of the decimal number", a, "is\n", i,h,g,f,e,d,c,b)
Binary To Decimal:
a=str(input("Enter The Number: "))
b=(a[7:8])
c=(a[6:7])
d=(a[5:6])
e=(a[4:5])
f=(a[3:4])
g=(a[2:3])
h=(a[1:2])
i=(a[0:1])
j=int(b)
k=int1 year ago
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 make4 years ago