title: GPA Calc Python
body: <p>I keep getting an error for this GPA calculator that is supposed to calculate your GPA based on 4 grades. Also the program needs to be terminated whenever a letter not named A,B,C,D,F is entered which i'm not sure how to do. </p>
  
  <pre><code>def GetName():
      name = raw_input ("Enter the student's name  ")
      grade1 = raw_input ("Enter a grade:  ")
      grade2 = raw_input ("Enter a grade:  ")
      grade3 = raw_input ("Enter a grade:  ")
      grade4 = raw_input ("Enter a grade:  ")
      return name, grade1, grade2, grade3, grade4
  
  def GetGrades(grade1, grade2, grade3, grade4):
          if [grade1, grade2, grade3, grade4] == 'A' or [grade1, grade2, grade3, grade4] == 'a':
                  [g1, g2, g3, g4] =4
          elif [grade1, grade2, grade3, grade4] == 'B' or [grade1, grade2, grade3, grade4] ==  'b':
                  [g1, g2, g3, g4] =3
          elif [grade1, grade2, grade3, grade4] == 'C' or [grade1, grade2, grade3, grade4] == 'd':
                  [g1, g2, g3, g4] =2
          elif [grade1, grade2, grade3, grade4] == 'D' or [grade1, grade2, grade3, grade4] == 'd':
                  [g1, g2, g3, g4] =1
          elif [grade1, grade2, grade3, grade4] == 'F' or [grade1, grade2, grade3, grade4] == 'f':
                  [g1, g2, g3, g4] =0
          else:
                  return 'invalid grade'
          return g1, g2, g3, g4
  
  def CalcGPA(g1,g2,g3,g4):
      GPA = (g1,g2,g3,g4)/4
      return GPA
  
  
  def main(name, GPA):
      print "The GPA for", name,"is",GPA
      return 0
  
  GetName()=name,grade1,grade2,grade3,grade4
  GetGrades(grade1,grade2,grade3,grade4)=g1,g2,g3,g4
  CalcGPA(g1,g2,g3,g4)=GPA
  main(name,GPA)=0
  </code></pre>