Question : python all elements in list in another list
Answered by : pleasant-panda-b24vj7zd1nm0
set(['a', 'b']).issubset(['a', 'b', 'c'])
Source : https://stackoverflow.com/questions/3931541/how-to-check-if-all-of-the-following-items-are-in-a-list | Last Update : Wed, 01 Jul 20
Question : python check all elements in list are in another list
Answered by : tense-tarantula-we3m6j7rn4xs
check = all ( item in first_list for item in second_list )
# check = True - All elements from first_list are in second_list
# check = False - Not all elements from first_list are not in second_list
Source : | Last Update : Mon, 14 Mar 22
Question : check if part of list is in another list python
Answered by : fair-finch-ukx50fa04idx
''' check if list1 contains any elements of list2
'''
result = any(elem in list1 for elem in list2)
if result: print("Yes, list1 contains any elements of list2")
else : print("No, list1 contains any elements of list2")
Source : | Last Update : Thu, 02 Jul 20
Question : Python check if all elements exist in another list
Answered by : lanya
fruits1 = ['Mango','orange','apple','jackfruit']
fruits2 = ['Mango','orange','apple','jackfruit']
new_list= all(item in fruits1 for item in fruits2)
if new_list is True: print("True")
else : print("False")
Source : https://pythonguides.com/check-if-a-list-exists-in-another-list-python/ | Last Update : Wed, 20 Jul 22