title: Convert a range score into a letter grade in Python
body: <p>I am trying to write a program that will convert a score between 0.0 and 1.0 into a letter grade. If the score is out of range, print an error message. If the score is between 0.0 and 1.0, print a letter grade using the following:</p>
  
  <pre><code>Score   Grade
  &gt;= 0.9  A
  &gt;= 0.8  B
  &gt;= 0.7  C
  &gt;= 0.6  D
  &lt;0.6    F
  </code></pre>
  
  <p>Requirements:</p>
  
  <ol>
  <li>Use the “input” command to take in user input for score</li>
  <li>check input to ensure that the score is in the rage of (0.0 to 1.0), if outside the rage - should output "Bad score"</li>
  <li>The supplied input is of type string by default, so it must be converted to the float type</li>
  <li>Should also catch a non-numeric input and print a “Bad score” error message.</li>
  </ol>
  
  <p>This is the code I have as of now:</p>
  
  <pre><code>import sys
  scores = input ("Enter your score: ")
  
  try:
      floatScores = float(scores)
  except:
      print ("Bad Score")
  
  if floatScores &gt;= 0.0 and floatScores &lt; 0.4:
      print ("You have a: F")
  elif floatScores &gt;= 0.6 and floatScores &lt; 0.7:
      print ("You have a: D")
  elif floatScores &gt;= 0.7 and floatScores &lt; 0.8:
      print ("You have a: C")
  elif floatScores &gt;= 0.8 and floatScores &lt; 0.9:
      print ("You have a: B")
  elif (floatScores &gt;= 0.9 and floatScores &lt;= 1.0:
      print ("You have an: A")
  
  else:
       print ("Bad Score")
  
  sys.exit()
  </code></pre>
  
  <p>Please advice.
  Thanks</p>