0

I am very new to python and learing daily

I have problem with the below code. For any string input it gives me ValueError How can I fix that error? Thank you for support

score = float(sr)

if score>=0.9 and score<=1 :
    print("A")
elif score >=0.8 and score <0.9 :
    print("B")
elif score>=0.7 and score <0.8 :
    print("C")
elif score>=0.6 and score <0.7:
    print("D")
elif score<0.6 :
    print("F") 

else : 
    print("bad score")```
  • Where does sr comes from? what did you put in it? using a . or badly a , ? – B. Go Dec 02 '19 at 01:28
  • Does this answer your question? [How do I parse a string to a float or int?](https://stackoverflow.com/questions/379906/how-do-i-parse-a-string-to-a-float-or-int) – B. Go Dec 02 '19 at 01:28

0 Answers0