+ 1

How to print the binary number s in python without the required digits

Python binary

20th Jun 2019, 3:26 PM
Karthik Devillers
Karthik Devillers - avatar
3 Respostas
+ 2
If you use the function bin on a number, a string is returned that represents the binary literal. And since it's a string, you can just slice it like any iterable and take out exactly the part you want. See here: https://code.sololearn.com/co2yThgC1yQA/?ref=app
20th Jun 2019, 3:44 PM
HonFu
HonFu - avatar
+ 1
print(bin(int(input()))[2:]) no?
20th Jun 2019, 4:45 PM
Choe
Choe - avatar
0
Hey it's not that
20th Jun 2019, 3:46 PM
Karthik Devillers
Karthik Devillers - avatar