title: cs50 readability pset6 python - Index calculation Issue
body: <h2>An Index calculation Issue in my pset6 readability</h2>
  <p>This is my code and I think it is correct but, the grade for every paragraph is wrong because the index calculation is wrong. Although, the letters, words, and sentence counting is correct. So, where is the problem? someone help me, please?</p>
  <pre><code>from cs50 import get_string
  import math
  
  # Loop to count the letters
  letters = 0
  words = 0
  sentences = 0
  
  # Prompt user for some text.
  text = get_string(&quot;Text: &quot;)
  
  # Loop to count the letters(s) of a paragraph
  def count_letters():
      global letters
      for i in range(len(text)):
          if text[i].lower() or text[i].upper():
              letters += 1
              # pass
      print(letters)
      return letters
  count_letters()
  
  # Loop to count the words of the paragraph.
  
  def count_words():
      global words
      for i in range(len(text)):
          if text[i].isspace():
              words += 1
          # TODO
          if text[i].isspace() and text[i + 1].isspace():
              words -= 1
      print(words + 1)
      return words + 1
  count_words()
  
  # Loop to count sentences of the paragraph.
  
  def count_sentences():
      global sentences
      for i in range(len(text)):
          if text[i] == &quot;.&quot; or text[i] == &quot;!&quot; or text[i] == &quot;?&quot;:
              sentences += 1
      print(sentences)
      return sentences
  count_sentences()
  
  # Calc the index of the grades
  
  def indexOfGrade():
      global letters
      global words
      global sentences
      l = letters / words * 100
      s = sentences / words * 100
      index = round(0.0588 * l - 0.296 * s - 15.8)
      print(letters / words)
      print(l)
      print(s)
      print(index)
  
      # grades
  
      if index &gt;= 16:
          print(&quot;Grade 16+&quot;)
      elif index &lt; 1:
          print(&quot;Before Grade 1&quot;)
      else:
          print(f&quot;Grade {index}&quot;)
  
  indexOfGrade()
  </code></pre>