title: Python: How to declare a global array of zeros depending on the input of the user?
body: <p>For my program, the user can input a particular n.</p>
  
  <p>Depending on that n, I need to create a global array with n buckets of size zero since I need to use this array in other functions + increment the elements in the bucket, which is again dependent on some conditions.</p>
  
  <pre><code>inv = []   # global var counts all inversion at level n
  order = [] # global var counts all ordered elements at level n
  
  def foo():
      # Using order and inv here 
  
  def main():
      # Save Input in variable in n
      n = int(raw_input())
      order = [0]*n
      inv = [0]*n
  </code></pre>
  
  <p>How can I do that? I always get an IndexError telling me that list index is out of range. Thanks!</p>