Various Numeric Literals in Python
#Numerical
Literals
print("Some
Numerical Literals")
print("Decimal
Integer Literals:")
print(-50)
print(758)
print(+3654)
print()
print("Octal
Integer Literals:")
print(0o57)
print(0O777)
print(0o234)
print()
print("HexaDecimal
Integer Literals:")
print(0x34);
print(0X4A);
print(0xC01);
print()
print("Floating
Point Literals:")
print("Fractional
Form")
print(27.5);
print(.95);
print(18.);
print(-29.0);
print(0.15);
print()
print("Exponent
Form")
print(0.75E03)
print(-2.25E-3)
print(7.5E04)
print(75.e2)
print()
print("Boolean
Literals")
print(True)
print(False)
print()
print("Special
Literal")
print(None)
Output
>>>
Some
Numerical Literals
Decimal
Integer Literals:
-50
758
3654
Octal
Integer Literals:
47
511
156
HexaDecimal
Integer Literals:
52
74
3073
Floating
Point Literals:
Fractional
Form
27.5
0.95
18.0
-29.0
0.15
Exponent
Form
750.0
-0.00225
75000.0
7500.0
Boolean
Literals
True
False
Special
Literal
None
>>>
No comments
Post your comments