-
-
Save parzibyte/b10555c1faa4961836036eac11537d95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
https://parzibyte.me/blog | |
""" | |
matriz = [ | |
[85, 45, 1, 7, 9], | |
[12, 52, 9, 151, 56], | |
[76, 10, 56, 99, 9], | |
] | |
# Inicializar y asumir que tanto el mayor como el menor están en el primer elemento; solo para inicializar | |
mayor = matriz[0][0] | |
menor = matriz[0][0] | |
# Momento de recorrer la matriz y obtener el mayor como el menor | |
for fila in matriz: | |
for valor in fila: | |
if valor > mayor: | |
mayor = valor | |
if valor < menor: | |
menor = valor | |
print("De la matriz: ") | |
print(matriz) | |
print(f"El menor es {menor} y el mayor es {mayor}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment