@valoro/

media_ponderada_3

Python

http://altocodigo.blogspot.com/2018/07/media-ponderada.html

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.47883654111605845","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IG51bXB5IGFzIG5wCng9WzcsNCw5LDMsNiwxMF0gI05vdGFzCnc9Wy4xLC4wNSwuMjUsLjA2LC4wOSwuNDVdICNQZXNvcwphcml0PW5wLm1lYW4oeCkKcHJpbnQoJ01lZGlhIGFyaXRtw6l0aWNhOicsYXJpdCkKeGE9bnAuYXJyYXkoeCkKd2E9bnAuYXJyYXkodykKcG9uZGVyYT1yb3VuZChzdW0oeGEqd2EpLDYpCnByaW50KCdNZWRpYSBwb25kZXJhZGE6Jyxwb25kZXJhKQ=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
import numpy as np
x=[7,4,9,3,6,10] #Notas
w=[.1,.05,.25,.06,.09,.45] #Pesos
arit=np.mean(x)
print('Media aritmética:',arit)
xa=np.array(x)
wa=np.array(w)
pondera=round(sum(xa*wa),6)
print('Media ponderada:',pondera)