I've an question in python! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

I've an question in python!

'0b1111' the number is in binary format! I need this number's decimal convertion ('0b1111' is in string format!) print(0b1111) ' ' ' answer is 15 in Python! but you can't type it directly! truth is I need that particular keyword! help me to find convert binary to decimal' ' '

19th Sep 2017, 2:55 PM
Shadow Windster
Shadow Windster - avatar
3 Answers
+ 3
@ Chandra I like your code! it's simple! What's Happening here?? I've no idea! why {} brackets used here?
23rd Sep 2017, 1:17 AM
Shadow Windster
Shadow Windster - avatar
- 1
you can simply do... print(bin(int(input("")))--(simplier) for dec to bin... 0b is a format.. it represents a bin number
23rd Sep 2017, 3:48 AM
sayan chandra
sayan chandra - avatar