数据类型:
int():整数型 如a=123
float():浮点数 如b=1.23
complex():复数 如c=3+4j
类型函数:
type()
E记法:
3.1415*100000000000000000000=3.1415e+20(e+20表示小数点向右移20位)
3.1415/100000000000000000000=3.1415e-20(e-20表示小数点向左移20位)
作业:打印正弦波
y=sinx
工具:1.numpy-数值计算扩展
2.matplotlib(matlab)-绘图库
安装numpy:pip install numpy
matplotlib: pip install matplotlib
代码:
import numpy as np
import matplotlib.pyplot as plt
x=np.arange(0,2*np.pi,0.01) # x的范围为0-2pi,每次增长0.01
y=np.sin(x)
plt.plot(x,y)
plt.show()