What is the best way to compare two lists in Python and to check occurrences?
Consider that
list1 = [a, b, c]
list2 = [a, b, c, d, e, f, g]
I need two things:
- to check if
list1
contains elements fromlist2
and get back True or False - to check how many items (
len
?) fromlist2
are inlist1
and get back integer of those occurrences