Skip to content

Instantly share code, notes, and snippets.

@Macorreag
Created February 26, 2018 09:06
Show Gist options
  • Save Macorreag/7e2fd46c1539edba59f8cfee7f1e8a45 to your computer and use it in GitHub Desktop.
Save Macorreag/7e2fd46c1539edba59f8cfee7f1e8a45 to your computer and use it in GitHub Desktop.
Anidación de for en python para recorrer listas
ar = [[x,y,z] for x in xlist for y in ylist for z in zlist if x + y + z != n]
print(ar)
#Es la misma sentencia que la de abajo
for x in xlist:
for y in ylist:
for z in zlist:
if (x+y+z != n):
print([x,y,z])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment