How to check a list contained by another list without a loop?
Depends on what you mean by "contained". Maybe this:
if set(a) <= set(b):
print "a is in b"
Assuming that you want to see if all elements of sublist
are also elements of superlist
:
all(x in superlist for x in sublist)
You might want to use a set
if set(a).issubset(b):
print('a is contained in b')