Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python float() Function

Python float() Function

Python built-in function Python built-in function


Description

float() The function is used to convert integers and strings into floating-point numbers.

Syntax

float() Method Syntax:


class float([x])

Parameters

Return Value

Returns a floating-point number.

Example

The following examples show the use of float():

float

(

1

)

1.0

float

(

112

)

112.0

float

(

123.6

)

123.6

float

(

'

123

'

)

String

123.0

Python built-in function Python built-in function