0

how to convert a string to a float

plz help me

2nd May 2020, 6:57 PM
vinayak chikkam
vinayak chikkam - avatar
4 ответов
+ 3
float("2")
2nd May 2020, 7:01 PM
Abhay
Abhay - avatar
+ 2
float("3.14")
2nd May 2020, 7:01 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
n=input() n=float(n) Input accept values as strings.. float(n) converts n to float, if compatible types. So simply n=float(input()) n contains float value, ex input: 12 n=12.00000000
2nd May 2020, 7:01 PM
Jayakrishna 🇮🇳
+ 1
float(string)
2nd May 2020, 7:15 PM
ycsvenom
ycsvenom - avatar