title: Unable to use loop as below requirement for each customer record
body: <p>I have a requirement that for each customer 1,2,3 , if address is present then only it should be included under XML.
  Suppose for customer 1 there is AddressType both B and D and for Customer 2 there is AddressType only B, C.</p>
  <p>Expected output is:</p>
  <pre><code>&lt;xml version CIF  1
  Mailing Address for Customer  is B
  Home Address for Customer is D
  
  &lt;xml version CIF  2
  Mailing Address for Customer  is B
  
  #For Customer3 again there was both AddressType present so it should be as follows
  &lt;xml version CIF  3
  Mailing Address for Customer  is B
  Home Address for Customer is D
  </code></pre>
  <p>Python program that I have written is as below:</p>
  <pre><code>#Initialinzing the variables to blank
  MailingAddress=''
  PermanentAddress=''
  Customer = [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;]
  for x in Customer:
    Customer=x[0]
    #print(Customer)
    #time.sleep(6)
    ADDRESS=[&quot;B&quot;,&quot;C&quot;,&quot;D&quot;]
    XML=f'&lt;xml version CIF  {str(Customer)}\n'
    for y in ADDRESS:
      AddrData=y[0]
      #print(ADDRESS)
      #MailingAddress=''
      if AddrData ==&quot;B&quot;:
          MailingAddress=f'Mailing Address for Customer  is {(AddrData)}\n'
      #PermanentAddress=''
      if AddrData ==&quot;D&quot;:
          #print(ADDRESS)
          PermanentAddress=f'Home Address for Customer is {(AddrData)}\n'
  
      ADDRESS=[&quot;B&quot;,&quot;C&quot;]  # For suppose next record doesn't have PermanentAddress 
                         # so hardcoded changes maked.
      #print(MailingAddress,PermanentAddress)
    XML+= MailingAddress+PermanentAddress
    print(XML)
  </code></pre>