Numbers and Strings
Learn about the different categories that fall under the numbers and strings section in Python.
We'll cover the following...
We'll cover the following...
Introduction to numbers
There are several different kinds of numbers in Python. The following describes all of these:
- A decimal integer consists of either the number 0 or a sequence of digits not beginning with 0.
- A binary integer consists of binary digits (0, 1), beginning with
0bor0B. - An octal integer consists of a sequence of octal digits (0 to 7), beginning with
0oor0O. - A hexadecimal integer consists of a sequence of hex digits (0 to 9 and a to f or A to F), beginning with
0xor0X. - A floating-point (“real”) number includes a decimal point, an exponent suffix, or both. The exponent consists of an optional sign, the letter
eorE, and one or more digits. - An imaginary number consists of a decimal integer or a floating-point number, and it is suffixed by
j(not