title: Why is my function skipping lines of code in Python?
body: <p>Inside this function, inside the loop 'for j, i enumerate(data)' I have a loop 'for g in reversed(range(j)):'
   and this loop appends to listx.</p>
  
  <p>To test that I'm getting a meaningful data I put print(listx)</p>
  
  <p>now right below the appending loop I have print(listx), but it does not work. it doesn't print at all. I've also tried print("Hello") there to remove any variables, yet it doesn't print "Hello" either. </p>
  
  <p>What is causing this?</p>
  
  <pre><code>def filter_json(input):
      global d
      global t
  
      # open input file &amp; load json data
      content = open(input, "r").read()
      data = np.array([json.loads(str(i)) for i in content.strip().split('\n') 
  if i.strip()])
  
      # first extract D &amp; T from the first line of data
      d = int(data[0]['D'])
      t = int(data[0]['T'])
      listx = []
  
      for j, i in enumerate(data):
  
          try:
  
              if i['event_type'] == 'purchase':
  
                  listx = []
                  l = Graph()
                  l.network = set()
                  l.IDDFS(i['id'], d)
  
                  network_list = l.network
  
  
                  for g in reversed(range(j)):
                      # if data[g]['id'] in network_list
                      listx.append(data[g]['amount'])
  
                  print(listx)
                  print('Hello')
  
  
              elif i['event_type'] == 'befriend':
              addEdge(i['id1'], i['id2'])
  
              elif i['event_type'] == 'unfriend':
              removeEdge(i['id1'], i['id2'])
  
  
          except KeyError:
              continue
  </code></pre>