Notice there are no quotes around the number. It’s important to consider what you specifically mean by
"110" in quotes and
110 without the quotes in the examples above. As a human who’s used the decimal number system for your whole life, it might be obvious to you that you mean the number 110. However, there are several other number systems such as binary and hexadecimal, which use different bases to represent an integer.
So by typing
0b (zero b) before our number, we can see this actually represents 6 in binary. We have one, four, one, two, and no units. Doing the same in octal with an
0o) leads us to the value of 72.
03:02 because strings hold arbitrary text data. Now that you have some foundational knowledge about how to represent integers using string and int data types, you’l learn how to convert a Python string to an int.
Become a Member to join the conversation.