What is Float in Python
The float type in Python designates a floating-point number. float
values are specified with a decimal point.
>>> type(4.09) <class 'float'> >>> type(4.) <class 'float'> >>> .5e7 5000000.0 >>> type(.5e6) <class 'float'> >>> type(5/2) <class 'float'>
The Python float()
method returns a floating point number from a number or a string.
>>> float(10) 10.0 >>> float(113.32) 113.32 >>> float("13.32") 13.32 >>> float("nan") nan >>> float("inf") inf >>> float("infinity") inf
Subscribe
Login
Please login to comment
0 Discussion