python
来源:互联网 发布:qq影音windows版电脑版 编辑:程序博客网 时间:2024/05/21 08:50
大家好
def avg1(x): sum=0 i=0 for item in x: sum+=item i=i+1 avg=sum/len(x) return avg def fangcha1(x): fangcha=0 for item in x: fangcha=fangcha+(item-avg1(x))**2 fangcha=fangcha/len(x) return fangchadef xfc(x,y): s=0 for i in range(len(x)) : s+=(x[i]-avg1(x))*(y[i]-avg1(y)) s=s/len(x) return(s) def xfcxs(x,y): pxy=0 pxy=xfc(x,y)/((fangcha1(x)**(1/2))*(fangcha1(y)**(1/2))) print(pxy)xfcxs([1,2,3,4,5],[2,3,4,5,9])
阅读全文
0 0
- Python
- Python
- Python
- python
- Python
- PYTHON
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- python
- Python
- BZOJ 1034: [ZJOI2008]泡泡堂BNB 贪心题解
- zookeeper解析系列文档
- supervisord管理进程详解
- .LDS File
- compile boost for vs2015 on win10
- python
- Voice Conversion using Convolutional Neural Networks 翻译
- Servlet 工作原理解析
- c语言32个关键字_强制法则
- 血型遗传表,怎么记忆?根本不用记忆,自己组合一下就行了。
- flask发送错误日志到邮箱
- P3371 【模板】单源最短路径
- 数据库设计技巧
- 获取线程结束代码(Exit Code)