How to check if all items in a sub-list are in a list? Python -


this question has answer here:

my question pretty above:

if have 2 lists below, how can check if items in first list in second list. eg

list_one=[1,2,3] list_two=[1,2,3,4] 

my current attempt "if list_one in list_two:"

but condition never seems filled , nothing further takes place. appreciated :)

the all() function used check if condition satisfied .we getting elements list_1 , checking if available in list_2 if available print "yes"

list_one=[1,2,3]  list_two=[1,2,3,4] if all(a in list_two in list_one):     print "yes" 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -