Advertisement
teslariu

matrices

Sep 24th, 2021
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. compras = [
  5.             ['papa', 'zapallo', 'zanahoria'],
  6.             ['pera', 'anana', 'banana', 'mandarina'],
  7.             ['leche', 'yogur']
  8.         ]
  9.        
  10. # imprimo la lista
  11. print(compras)
  12.  
  13. for compra in compras:
  14.     print(compra)
  15.    
  16. for compra in compras:
  17.     for alimento in compra:
  18.         print(alimento)
  19.    
  20. # imprimir matriz matematica
  21. matriz = [
  22.             [1, 0, 3, 5, 6],
  23.             [5, 2, 7, -1, 6],
  24.             [11, 5, 8, 7, -3]
  25.          ]
  26.  
  27. for fila in matriz:
  28.     print(fila)
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement