title: How to round a number to a chosen integer
body: <p>In Denmark we have an odd grading system that goes as follows. [-3,00,02,4,7,10,12]
  Our assignment is to take a vector with different decimal numbers, and round it to the nearest valid grade. Here is our code so far. </p>
  
  <pre><code>import numpy as np
  
  def roundGrade(grades):    
      if (-5&lt;grades&lt;-1.5):
          gradesRounded = -3
      elif (-1.5&lt;=grades&lt;1.5):
          gradesRounded = 00
      elif (1.5&lt;=grades&lt;3):
          gradesRounded = 2
      elif (3&lt;=grades&lt;5.5):
          gradesRounded = 4
      elif (5.5&lt;=grades&lt;8.5):
          gradesRounded = 7
      elif (8.5&lt;=grades&lt;11):
          gradesRounded = 10
      elif (11&lt;=grades&lt;15):
          gradesRounded = 12
      return gradesRounded
  
  print(roundGrade(np.array[-2.1,6.3,8.9,9]))
  </code></pre>
  
  <p>Our console doesn't seem to like this and retuns:
  TypeError: builtin_function_or_method' object is not subscriptable</p>
  
  <p>All help is appreciated, and if you have a smarter method you are welcome to put us in our place. </p>