-
-
Save parzibyte/55239595a9f25e166497b3382eb532b7 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 | |
arreglo = [10, 7, 6, 10, 4, 9, 10, 5, 9, 8, 4, 3, 1, 10, 10, 10, 2] | |
# Para sumar simplemente recorremos el arreglo y aumentamos el valor | |
suma = 0 | |
for valor in arreglo: | |
suma = suma + valor | |
print(f"La suma es {suma}") | |
# Y el promedio se obtiene dividiendo la suma entre la cantidad de elementos | |
cantidad_elementos = len(arreglo) | |
promedio = suma / cantidad_elementos | |
print(f"El promedio es {promedio}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment