Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

I just want to know, Is there any function or module in python I can use to change a decimal number over to its binary? I can able to change the double over to decimal utilizing int('[binary_value]',2), so any approach to do the opposite without composing the code to do it without anyone else's help?

1 Answer

0 votes
by (26.4k points)

Every numbers are stored in binary. You can use bin(i), if you need a textual representation of a number into binary.

>>> bin(10)

'0b1010'

>>> 0b1010

10

Wanna become a python expert? Come and join the python certification course and get certified.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Oct 15, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
asked Oct 15, 2019 in Python by Sammy (47.6k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...