PIoT 课程
Python
程序设计
物联网工程专业核心课程
物联网工程专业核心课程
以 Python 为载体,培养物联网数据采集、处理、分析与可视化能力
依据:课程标准
采集 → 清洗 → 分析 → 可视化
一步接一步,越做越完整
依据:课程标准
10 章,从第一行代码
到一个完整项目
依据:课程标准

PIoT 编码工作台 · AI 错误诊断
依据:课程标准
理论与实践 1 : 1,边讲边练
每一章都是讲一段、练一段,课后再做综合实验
依据:课程标准

依据:PIoT《Python 程序设计》第 1–2 章

依据:PIoT《Python 程序设计》第 3 章
# 摄氏度转华氏度:一次定义 def c_f(c): f = c * 9 / 5 + 32 return f # 多次调用 c = float(input("摄氏度:")) f_temperature = c_f(c) print(f_temperature)
依据:PIoT《Python 程序设计》第 4–5 章
from math import radians, sin, cos, acos class Point: def __init__(self, lon, lat): self.__lon = lon # 经度 self.__lat = lat # 纬度 def getRadLon(self): return radians(self.__lon) def getRadLat(self): return radians(self.__lat) def distance(p1, p2): a, b = p1.getRadLat(), p2.getRadLat() c = cos(p1.getRadLon() - p2.getRadLon()) return 6371 * acos(sin(a)*sin(b) + cos(a)*cos(b)*c)
已知两座城市的经纬度,用 Point 类算出它们之间的距离
依据:PIoT《Python 程序设计》第 6 章
class LoginError(Exception): pass def ValidateUsernamePassword(username, password): if len(username) < 6: raise LoginError("用户名长度不少于6位") if len(password) < 9: raise LoginError("密码长度不少于9位") try: name, pwd = input("用户名:"), input("密码:") ValidateUsernamePassword(name, pwd) except LoginError as e: print(e)
依据:PIoT《Python 程序设计》第 7–8 章

依据:PIoT《Python 程序设计》第 9 章
import requests from bs4 import BeautifulSoup # url:空气质量数据页地址(占位) response = requests.get(url=url, headers=headers) response.encoding = 'GBK' soup = BeautifulSoup(response.text, 'html.parser') r1 = soup.find('div', attrs={'class': 'citychk'}) for child in r1.find_all('dl'): province = child.dt.b.text for city in child.find_all('a'): city_list.append([province, city.text, city.get('href')])
依据:PIoT《Python 程序设计》第 10 章


依据:PIoT《Python 程序设计》第 10 章
import random def newNumber(): # 出题 return random.randint(1, 101) def guessNumber(number): # 猜题 yAnswer = int(input("enter a integer between 0-100:")) if yAnswer > number: print("too big") elif yAnswer < number: print("too small") else: print("right"); return 1 return 0 def guessTime(number): for i in range(10): if guessNumber(number) == 1: break

依据:PIoT《Python 程序设计》第 5 章
过程 30% + 实践 20% + 期末 50%
平时表现、实践项目和期末考试一起算,不只看一张卷子
依据:课程标准

依据:课程标准
从一行 print 到一个完整的数据分析项目
Python 程序设计