Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- """
- Crear una función que
- 1) tome como argumento una matriz, de cualquier
- dimensión, e imprima cada uno de sus números en una línea diferente.
- Por ejemplo, el siguiente código:
- m1 = [[3.3, 6.1, 4.0], [4.9, 5.7, 6.4]]
- imprimir_matriz(m1)
- debe imprimir:
- 3.3
- 6.1
- 4.0
- 4.9
- 5.7
- 6.4
- 2) Tome como argumento un diccionario e imprima los pares de claves y
- valores
- """
- def imprimir_matriz(matriz):
- for fila in matriz:
- for numero in fila:
- print(numero)
- def imprimir_diccionario(dicc):
- print("\nclave valor")
- print("------------")
- for k,v in dicc.items():
- print(k,v)
- m1 = [[3.3, 6.1, 4.0], [4.9, 5.7, 6.4]]
- agenda = {11233: 'ale', 454556: 'ale', 21344: 'pepe', 45646: 'ale'}
- imprimir_matriz(m1)
- imprimir_diccionario(agenda)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement