converting from decimals to binary in Python

twitter logo github logo ・1 min read

I started listening to this podcast

Which so far seems like a good podcast to listen to if you are starting to learn about Computer Science. Or just want a refresh.

While listening to the first episode I wondered ...

In Python how do you convert into hex or binary from a decimal number?

a = 43
# now binary
# now hex

The functions bin and hex will convert a number into a string representation for binary and hexadecimal.

twitter logo DISCUSS
Classic DEV Post from Apr 3

Workspace Wednesday: Show off your desk/computer setup!

Let’s share pics of everybody’s setups. Feel free to add details about your ha...

Tony Colston profile image
wanna be gamedev ... all around nerd and dev