0
how to convert a string to a float
plz help me
4 Réponses
+ 3
float("2")
+ 2
float("3.14")
+ 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
+ 1
float(string)