Question-15: How do you represent octal number in Python program?
- Number should start with 0x (Zero-x)
- Number should start with x0 (x-zero)
- Number should start with O-0 (O-zero)
- Number should start with 0-O (zero-O)
Answer: D
Exp:
Octal Numbers
- If Number value is preceded by (0-o), which is zero and “O” . It represent octal values.
- Octal values can hold each integer value between 0 to 7
print(0o444) print(0o666) print(0o777) |
- If you use value bigger than 7, it would give error.
print(0o888) |
Hexadecimal number
- This should be preceded by 0X (Zero-X)
print(0x44) print(0X666) print(0x777) print(0x15) |