title: Python loop not fully respecting a set rule
body: <p>I am looking to flag emails based on the sender on a shared outlook mailbox as quick as possible.</p>
  <pre class="lang-py prettyprint-override"><code>#imports:
  import time
  from time import strftime
  import pandas as pd, win32com.client as client
  from win32.com.client import Dispatch
  
  #importing the excel file that contains email addresses and corresponding flags:
  df_excel = pd.read_excel(r'\\user\...\addresses.xlsx')
  #adding both columns as lists:
  df_excel_mail = df_excel['mail'].tolist();df_excel_flag = df_excel['flag'].tolist()
  outlook = client.Dispatch('Outlook.Application').GetNamespace('MAPI')
  main_account = outlook.Folders.Item(1)
  folder_inbox = main_account.Folders['Inbox'].Folders['Test']
  folder_inbox_WIP = main_account.Folders['Inbox'].Folders['Test'].Folders['WIP']
  
  while True:
      time.sleep(0)
      messages = folder_inbox.Items.Count
      if messages &gt; 0:
          for i in reversed(range(0,messages)):
              message = folder_inbox.Item[i]
              for y, z, in zip(df_excel_mail,df_excel_flag)
                  if message.Categories == '' and y == message.SenderEmailAddress
                      message.Categories = z
                      message.Save
                      message.Move(folder_inbox_WIP)
  
      messages_v2 = folder_inbox_WIP.Items.Count
      if folder_inbox_WIP .Items.Count &gt; 0:
          for ii in reversed (range(0,messages_v2)):
              message_v2 = folder_inbox_WIP[ii]
              message_v2.Move(folder_inbox)
  
      if strftime('%H, %M, %N') &gt;= strftime('18:00:00')
          break
  </code></pre>
  <p>my addresses.xlsx sheet looks like that:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>mail</th>
  <th>flag</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>aaa.bbb@mail.com</td>
  <td>red color</td>
  </tr>
  <tr>
  <td>ccc.ddd@outlook.com</td>
  <td>green color</td>
  </tr>
  <tr>
  <td>...</td>
  <td>...</td>
  </tr>
  <tr>
  <td>eee.fff@client.com</td>
  <td></td>
  </tr>
  <tr>
  <td>...</td>
  <td>...</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>When an email address is available in the df_excel_mail list but corresponding flag color is missing in the df_excel_flag list. some emails are sent to WIP folder anyway and flagged as #QNAN.</p>
  <p>How is this possible when the following code is supposed to prevent that to happen ?</p>
  <pre><code>if message.Categories == '' and y == message.SenderEmailAddress
  </code></pre>