title: how to change index value in python lists
body: <p>I am trying to check the elements of two lists in python to see if they contain the same values in the same position (indexes) of them. If an element let's say in position 0 of list A is not the same with the element in position 0 of list B I want to extract that value from list A and start again the comparison. </p>
  
  <p>My program is below:</p>
  
  <pre><code> listA = ["book","2","stage","me","you"]
   listB = ["stage","me","you"]
  </code></pre>
  
  <p>listB is always a sublist of listA!!</p>
  
  <pre><code>  diff_list = []
    for n in range(0, len(listA)):
       for k in range(0, len(listB)):
           if n == k:
              if listA[n] != listB[k]:
                   rm_item = listA.pop(n)
                   diff_list.append(rm_item)
                   k==0
                   print(k)
  </code></pre>
  
  <p>In my terminal first k = 0 then k = 1. Is there a way to remove the item from listA and then start the comparison again?</p>
  
  <p>Thanks for the help guys! To be honest....What I wish to do is to get the difference between two strings. I have two texts where text B is always subtext of text A. So I used splitlines() to split the two texts and then I want compare the two lists to get what I want! 
  Sorry but I am new to python and still can't figure out how a lot of things are done!</p>
  
  <p>So I have </p>
  
  <pre><code>   textA='The first paragraph of the book is written well' 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>   textB = 'the book is written well'
  </code></pre>
  
  <p>the result should be</p>
  
  <pre><code>  text_diff ='the first paragraph of' 
  </code></pre>