In this example we will show how to construct a float number from an integer literal, a float literal or a string literal in Python.
Source Code
a = float(6) # a will be 6.0
print(a)
b = float(6.6) # b will be 6.6
print(b)
c = float('6') # c will be 6.0
print(c)
d = float('6.6') # d will be 6.6
print(d)
Output:
6.0
6.6
6.0
6.6