Python float() built-in function

From the Python 3 documentation

Return a floating point number constructed from a number or string x.

Introduction

The float() function in Python is a built-in function that allows you to convert a number or a string containing a number into a floating-point number. This is particularly useful when you need to perform arithmetic operations that require decimal precision.

The float() function returns a floating point number from a number or a string.

Examples

>>> float('10')
# 10.0
>>> float(10)
# 10.0

Subscribe to pythoncheatsheet.org

Join 16,702+ Python developers in a two times a month and bullshit free publication , full of interesting, relevant links.