How to check if a list contains all the elements of another list Python

1 Answer

0 votes
lst1 = [3, 6, 4, 8, 9] 
lst2 = [3, 4, 8]
 
result =  all(elem in lst1 for elem in lst2)
 
if result:
    print("true")    
else :
    print("false")


 
'''
run:
 
true
 
'''

 



answered Aug 14, 2019 by avibootz
...