+ 1

How to print binary of numbers in python simple method

31st Oct 2017, 3:35 PM
Rabeeh RaaZz
Rabeeh RaaZz - avatar
2 Réponses
0
num=int(input()) print(bin(num))
31st Oct 2017, 4:20 PM
sayan chandra
sayan chandra - avatar
+ 6
When converting the other way round, you might also use the int() method's second parameter to specify the base (10 by default): int('1101', 2) == 13
31st Oct 2017, 4:28 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar