Problema de estadistica

from pylab import *

f=[]
p=[]
m=0
print("Introduzaca una resistencia con rango 975 y 1025 OHMS\n")
c=int(input("Numero de muestras\n"))
b=4
print("Valor de la resistencias")
print("Son cuatro lecturas")
for j in range(c):
m=m+1
print("Muestra ",m)
s=0
for i in range(b):

a=float(input(""))
if a>974 and a<1026:
p.append(a)

else:
print("Error")
f.append(p)
p=[]

p2=0
r2=0
for i in range(len(f)):
 for j in range(b):
  s=s+f[i][j]
 
 p=s/b
 p2=p2+p
 f[i].append(p)
 rango=max(f[i])-min(f[i])
 f[i].append(rango)
 r2=r2+rango
 s=0

rf=r2/c
pf=p2/c
print()
print("   Muestras                                Lecturas(OHMS)                                Promedio               Rango" )
 
for i in range(len(f)):
 print("      \t",i+1,"         \t",end="")
 for j in range(6):
  print("       \t",f[i][j],end="")
 
 
 print()

print("                                                                                        PROM \t%.1f"%(promediof),"    \t%.1f"%(rf))
LCI=pf-(.729*rf)
LCS=pf+(.729*rf)
r3=rf*0
r4=rf*2.282
print("                                                                                        LCS \t%.1f"%(LCS),"        \t%.1f"%(r4))
print("                                                                                        9LCI \t%.1f"%(LCI),"       \t",r3)

x=[]
PROM=[]
graficalCS=[]
graficalCI=[]

for i in range (len(f)):
graficalCI.append(LCI)
graficalCS.append(LCS)
x.append(pf)
PROM.append(f[i][4])

plt.title("RESISTENCIAS")
plt.ylabel("OHMS")
plt.xlabel("N° Muestra ")
plt.plot(PROM,label="PROM", marker="s", linestyle="-", color="b")
plt.plot(x,label="x",marker="D", linestyle="-",color="g")
plt.plot(graficalCS,label="LCS", marker="^", linestyle="-", color="r")
plt.plot(graficalCI,label="LCI", marker="x", linestyle="-", color="c")
plt.legend(loc="lower left")
plt.show()

gr=[]
PR=[]
graficaCS2=[]
graficaCI2=[]

for i in range (len(f)):
graficaCI2.append(r4)
graficaCS2.append(r3)
gr.append(rf)
PR.append(f[i][5])

plt.title("RANGOS")
plt.ylabel("OHMS")
plt.xlabel("N° Muestra ")
plt.plot(PROMrango,label="PROM", marker="s", linestyle="-", color="b")
plt.plot(graficarango,label="x",marker="D", linestyle="-",color="g")
plt.plot(graficalCS2,label="LCS", marker="^", linestyle="-", color="r")
plt.plot(graficalCI2,label="LCI", marker="x", linestyle="-", color="c")
plt.legend(loc="lower left")
plt.show()

Comentarios