float()Easy Examples

Converts a value to a floating-point number

Basic float() usage

Simple demonstration of the float() built-in function.

python
print(float("3.14"))
print(float(42))
print(float("inf"))
print(float("-inf"))

float() is a built-in function that converts a value to a floating-point number.

float() with different inputs

Calling float() with various argument types.

python
# More float() examples
print("float() is a Python built-in function")
print(f"Type: {type(float)}")

float() accepts different types of arguments and produces corresponding results.

Want to try these examples interactively?

Open Easy Playground