title: Python - Update an old_list if a new_list has a different value
body: <p>I am trying to make a script where I check a old_list and a new_list. If the new_list has a different values than Old_list. It will check with a if-elif statement if the old_list has more values/element than new_list and if it has it shouldn't do anything and vice versa.</p>
  
  <pre><code>old_list = {'name': 'Hello', 'code': ['Medium', 'Easy', 'Hard']}
  
  while True:
  
      new_list = {'name': 'Stackoverflow', 'code': ['Hard', 'Easy']}
  
      try:
          if any(i not in old_list['code'] for i in new_list['code']):
  
              if old_list['code'] &gt; new_list['code']:
                  print("Element removed")
                  old_list['code'] = new_list['code']
  
              elif old_list['code'] &lt; new_list['code']:
                  print("New elements added")
                  old_list['code'] = new_list['code']
  
          else:
              randomtime = random.randint(1, 2)
              time.sleep(randomtime)
              continue
  
      except Exception as err:
          randomtime = random.randint(1, 2)
          time.sleep(randomtime)
          continue
  </code></pre>
  
  <p>The output should be <strong>"Element removed"</strong> and the value should update <code>old_list['code']</code> from <code>['Medium', 'Easy', 'Hard']</code>to <code>['Hard', 'Easy']</code>. But right now it doesn't even go through the <code>if any(i not in old_list['code'] for i in new_list['code']):</code> since the values in <code>code</code> are in both but there is no "Medium" in new_list but for some reason which I don't know it doesn't get through and it does the <code>else</code> instead.</p>
  
  <p>How can I possible make it so it updates the values if new_list has more/less values/elements than old_list and then print out if element gets removed or added?</p>