fork download
  1. L=[[1,2,3],
  2. [4,2,1],
  3. [9,8,7]]
  4.  
  5. def recorrerColN(L, F):
  6. L2 = []
  7. for i in range(len(L)):
  8. L2.append(L[i][F-1])
  9. return L2
  10.  
  11. print(recorrerColN(L, 2)) # Pasando la lista L y el número de columna 2 (tercera columna)
  12.  
Success #stdin #stdout 0.04s 9656KB
stdin
Standard input is empty
stdout
[2, 2, 8]