title: Python Using a For loop inside a function
body: <p>I'm a Python beginner trying write a program that will allow the user to input individuals names and test scores and I am supposed to give back a grade after finding the average so far I've been able to write the program but I am experiencing difficulties trying to debug it. 
  my programs works fine until it starts to calculate the average, it usually displays an error message saying</p>
  
  <pre><code>"TypeError: 'float' object is not subscriptable" 
  </code></pre>
  
  <p>Could somebody please help me why my codes are not working? Thank you for your help in advance!</p>
  
  <pre><code>def calcaverage(test1,test2,test3):
      for count in range(numofstudent):
          curraverage=((test1[count]+ test2[count]+ test3[count])/3)
          if curraverage&gt;= 90:
              grade= "A"
              return grade 
          else:
              if curraverage &gt;= 80 and curraverage &lt; 90:
                  grade= "B"
                  return grade
              else:
                  if curraverage &gt;= 70 and curraverage &lt; 80:
                      grade= "C"
                      return grade
                  else:
                      if curraverage &lt; 70:
                          grade= "F"
                          return grade
  
  numofstudent=int(input("How Many Students?: "))
  students=[]
  test1=[]
  test2=[]
  test3=[]
  averagescore=[]
  grade=[]
  for count in range(numofstudent):
      currstudent=input("Please enter name of student: ")
      students.append(currstudent)
      currstudenttest1= float(input("First test score?: "))
      currstudenttest2= float(input("Second test score?: "))
      currstudenttest3= float(input("Third test score?: "))
      test1.append(currstudenttest1)
      test2.append(currstudenttest2)
      test3.append(currstudenttest3)
  
  grade=calcaverage(test1,test2,test3)
  averagescore.append(grade)
  print([students], "your grade is " ,[grade])
  </code></pre>