0

i have a little problem in my code. When I display it I get the number and "0b" at the beginning. And what I want to do is to get rid of that "0b" and get just number.For example:

11000

so here's my code:

import time
dec = input("decimal number: ")
decimal = int(dec)
print(decimal,"in binary is:",bin(decimal))
time.sleep(4)

and that's my output:

decimal number: 24
24 in binary is: 0b11000

(giving other numbers doesn't change anything)

tymek
  • 3
  • 1

1 Answers1

-1

You can just slice it.

print(decimal,"in binary is:",str(bin(decimal))[2:])
Mert Köklü
  • 2,183
  • 2
  • 16
  • 20