0

I have 2 generated lists with a different number of elements in them like these:

list_A = [A,B,C,D,F,G,H]
list_B = [A,B,D,F,N]

and I want to output the first element of each list that is not the same as in the other list : Example Output:

From List A: 'A'
From List B: 'D'

The problem is that I don't know which of the two generated lists has more elements so what I tried is problematic:

for k in range(len(list_B)):
                          while list_A[k] == list_B[k]:
                                                     continue
                          print('From List A:', list_A[k])
                          print('From List B:', list_A[0])
  • 5
    "first element of each list that is not the same as in the other list" wouldn't that be C for list_A? – rdas Sep 24 '22 at 21:19

0 Answers0