Computer Applications
How many types of integer literals are allowed in Python ? How are they written ?
Answer
The types of integer literals allowed in Python are as follows:
- Decimal form — Integers written in decimal form do not begin with a zero and contain only 0 to 9 digits.
- Octal form — Integers written in octal form begin with a 0 and contain only 0 to 7 digits.
- Hexadecimal form — Integers written in hexadecimal form begin with a 0x and contain only 0 to 9 digits and A to F or a to f letters.