title: Error_message: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
body: <p>I'm having a problem with my code: when I make a search in the i-th column of the matrix it gives me the following error:</p>
  
  <pre><code>if grades[:,i]!=-3:
  
  ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
  </code></pre>
  
  <p>I have tried to read the older posts on this issue, but can't really relate to my problem</p>
  
  <p>I am trying to program a grading function according to danish grading-scale</p>
  
  <pre><code>def computeFinalGrades(grades):
      #looping over the leth of grades
      for i in range(len(loopingrange)):
          #checking if any grade in the i-th coloumn is -3  
          if grades[:,i]==-3:
          #if a grade is equal to -3 then the output variabel gradesFinal is -3  
              gradesFinal = -3
          else:
          #looping over all grade coloumns that do not contain one or more grades of -3
              for i in range(len(loopingrange)):
                #Checking to see if any coloumn only contains 1 grade  
                  if (len(grades[:,i]) == 1):
                # if a coloumn only contains 1 grade - that is also the final grade      
                      gradesFinal = grades[:,i]
                 #Checking to see if coloumn contains more than 1 grade and those grades are not -3     
                  elif (len(grades[:,i]) &gt; 1):
                      #storing all the grades in a variabel - in random order
                      unsortedgrades = grades[:,i]
                      #sorting all the grades from lowest to highest
                      sortedgrades1 = np.sort(unsortedgrades)
                      #slicing the lowest grade out using indexing
                      sortedgrades = sortedgrades1[1::]
                      #finding the final grade as the mean of the n-1 grades
                      gradesFinal = np.mean(sortedgrades)
      return gradesFinal
  </code></pre>