title: Python: TypeError: 'NoneType' object is not subscriptable
body: <pre><code>#Uses python3
  
  import sys
  
  def max_dot_product(a,b,n):
  
  
      a = a.sort(reverse=True)
      b = b.sort(reverse=True)
      res = 0
  
      for i in range(n):
          res += a[i]*b[i]
      return res
  
  if __name__ == '__main__':
      data = [int(x) for x in input("").split()]
      n = data[0]
      a = data[1:(n + 1)]
      b = data[(n + 1):]
      print(max_dot_product(a,b,n))
  </code></pre>
  
  <p>When I run this code, it reveals that "TypeError: 'NoneType' object is not subscriptable".</p>