Hi I have two lists list1 and list2 I want to extract all values that exist in list1 and don’t exist in list2. I tried this code: Read more
0
0
Be the first one react
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can simly use a for loop with append to list. list1 = ['lion', 'dog', 'cat', 'tiger', 'cat', 'cat', 'zebra'] list2 = ['monkey', 'tiger', 'cow', 'mouse'] my_list = [] for animal in list1: #iterating over list1 if animal not in list2 and animal not in my_list: my_list.append(animal) #add item to tRead more
You can simly use a for loop with append to list.
kind regards
See less