amonroejj
0
Q:

string to float python

string = "88.88"
print(float(string))
# output
# 88.88
2
# Use the function float() to turn a string into a float
string = '123.456'
number = float(string)
number
# Output:
# 123.456
10
float(str)
#ValueError in case of invalid entry like "abc" "12c"
1
# Python code to demonstrate Type conversion 
# using int(), float() 
  
# initializing string 
s = "10010"
  
# printing string converting to int base 2 
c = int(s,2) 
print ("After converting to integer base 2 : ", end="") 
print (c) 
  
# printing string converting to float 
e = float(s) 
print ("After converting to float : ", end="") 
print (e) 
1
value1 = "10"
value2 = 10.2

print(int(value1))
print(int(value2))
3
score = 89
score = str(score)
0

New to Communities?

Join the community