title: Python GPA Calculator
body: <p>I'm working on a GPA calculator in python 2. However, I cannot get the code to work as I want. I was hoping if someone could me out and provide me some direction. When I put in grades I want it to calculate a GPA. Now, it only reads a letter or a symbol, but not both together. I'll put in A+ it'll give me .3 not 4.3. If I put in multiple grades, it'll only read the first grade.
  The for part takes all the grades entered, and gives us the average GPA.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>from sys import argv
  
  def gp(grade):
      points = 0
      if grade == 'A' or grade == 'a':
          points +=  4.0
      if grade == 'B' or grade == 'b':
          points += 3.0
      if grade == 'C' or grade == 'c':
          points += 2.0
      if grade =='D' or grade == 'd':
          points += 1.0
      if grade == 'F' or  grade =='f':
          points += 0.0
      if grade.endswith ('+'):
          points = points + 0.3
      if grade.endswith ('-'):
          points = points - 0.3
      for x in grade
          return points = sum(points)/len(grade)
  
  if __name__ == '__main__':
      grade = argv[1].replace(" ","")
      print (("%.1f") % gp(grade))
  </code></pre>