一、Line chart
'''
功能:作折线图 function
作者:Sherry author
日期:2021年10月9日 date
'''
import numpy as np
import matplotlib.pyplot as plt
temperatures = np.array([17,20,36,20,22,19,36,20,32,28,29])
plt.plot(temperatures)
#输出之后有一个反馈
plt.show()
'''
x = np.linspace(-np.pi,+np.pi,100)
y = np.sin(x)
plt.plot(x,y)
plt.show()
'''
效果图:
二、Sum
'''
功能:两个整数求和 function
作者:Sherry author
日期:2021年10月9日 date
'''
# 输入部分·input
a = int(input("a = ")) # -- in pair
b = int(input("b = "))
# 处理部分 -process
sum = a + b
# 输出部分 -output - product
input(sum)
print("sum = %d" % sum)
print("%d + %d = %d" % (a, b, sum))
print('{1} + {0} = {2}'.format(a, b, sum))
print('{0} {0} {0} {0}'.format(sum))
'''
Ctrl + D --行复制
Ctrl + x --行删除
Shift + Enter --直接换行
Ctrl + Alt + L --添加空格(美化格式’现仅pycharm可用‘)
'''
三、HomeWork
Cirle:
'''
功能:计算圆的周长与面积。
作者:Sherry
时间:2021.10.10
'''
import math
r = float(input('r = '))
C = 2 * math.pi * r
S = math.pi * r **2
print('圆的周长是%.2f, 圆的面积是%.2f' %(C, S))
第二节课内容