python - Whats the correct list comprehension syntax for this -


if have 2 lists:

e = [3,1,5,8], w = [1,2,4]

and want go in , check element of e evenly divisible every element of w, how do in list comprehension? using 2 lists, 8 should returned since 8 % each in w give zero.

in terms of loop i'm thinking of like:

for in e:     j in w:         if % j == 0:             print 

but incorrect!

[i in e if all(i % j == 0 j in w)] 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -