commit 7df250638d676fb31037799e489bd2ee0238ec04 Author: sairate Date: Sat Jul 5 09:36:00 2025 +0800 chore: 添加项目基础结构和示例代码 - 创建 .idea 目录和相关配置文件,设置项目结构 - 添加多个课堂成果示例代码,涵盖不同主题和功能 - 创建和配置 .gitignore 文件,忽略特定文件和目录 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..359bb53 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml diff --git a/.idea/PythonV1_V2.iml b/.idea/PythonV1_V2.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/PythonV1_V2.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..36de856 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,15 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml new file mode 100644 index 0000000..312455a --- /dev/null +++ b/.idea/material_theme_project_new.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..23231ce --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b6f5533 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/第10讲超市大促销/10超市大促销讲义.pdf b/第10讲超市大促销/10超市大促销讲义.pdf new file mode 100644 index 0000000..17addac Binary files /dev/null and b/第10讲超市大促销/10超市大促销讲义.pdf differ diff --git a/第10讲超市大促销/课堂成果/9_1 早餐吃什么.py b/第10讲超市大促销/课堂成果/9_1 早餐吃什么.py new file mode 100644 index 0000000..6549d5d --- /dev/null +++ b/第10讲超市大促销/课堂成果/9_1 早餐吃什么.py @@ -0,0 +1,9 @@ +food_choice = input("1.吃水果;2.吃牛排;3.吃零食。请选择:") +if food_choice == "1": + print("早餐吃水果,补充维C快成长") +elif food_choice == "2": + print("早餐吃牛排,一定要适量") +elif food_choice == "3": + print("早饭吃零食,非常不健康") +else: + print("输入错误,请重新输入") \ No newline at end of file diff --git a/第10讲超市大促销/课堂成果/课后作业_远方的邀请函.py b/第10讲超市大促销/课堂成果/课后作业_远方的邀请函.py new file mode 100644 index 0000000..6d82a15 --- /dev/null +++ b/第10讲超市大促销/课堂成果/课后作业_远方的邀请函.py @@ -0,0 +1,9 @@ +print("幸运的小冒险家:") +print("恭喜您被选中参加2023年世界级最无聊之数豆子锦标赛。") +answer = input("您是否愿意参加比赛接收挑战呢?请回答'是'或者'否':") +if answer == "是": + print("加油,期待你成为无聊之王!") +elif answer == "否": + print("机不可失时不再来,真的不想想了吗?") +else: + print("题都没读懂,失去参赛资格!") \ No newline at end of file diff --git a/第10讲超市大促销/课堂成果/超市大促销.py b/第10讲超市大促销/课堂成果/超市大促销.py new file mode 100644 index 0000000..51d96cb --- /dev/null +++ b/第10讲超市大促销/课堂成果/超市大促销.py @@ -0,0 +1,33 @@ +print("亲爱的上帝朋友们:") +print("为回馈大家对本店的大力支持,本店将开展为期3天的促销活动。") +print("我们将指派P仔为促销折扣官。") +print() +kind = input("您要查询的品类是?请输入'水果'或者'肉类'或者'零食':") +if kind == "水果" : + answer = input("查询'水果种类'还是'折扣力度':") + if answer == "水果种类" : + print("水果种类有:香蕉,苹果,桃子,樱桃,榴莲,李子") + elif answer == "折扣力度" : + print("全场水果九折优惠") + else: + print("...没理解您的问题,请重新查询...") +elif kind == "肉类" : + answer = input("查询'肉类种类'还是'折扣力度':") + if answer == "肉类种类" : + print("肉类种类有:猪五花,羊肉,牛排,鸡腿,鸡翅,鱼肉") + elif answer == "折扣力度" : + print("全场肉类八折优惠") + else: + print("...没理解您的问题,请重新查询...") +elif kind == "零食": + answer = input("查询'零食种类'还是'折扣力度':") + if answer == "零食种类" : + print("零食种类有:酸奶,黄桃干,巧克力威化,奥利奥,薯片,鱿鱼丝,AD钙奶") + elif answer == "折扣力度" : + print("全场零食七折优惠") + else: + print("...没理解您的问题,请重新查询...") +else: + print("其余商品原价出售") +print() +print("查询完毕,祝您购物愉快,欢迎随时来找我玩哟~") \ No newline at end of file diff --git a/第10讲超市大促销/超市大促销.png b/第10讲超市大促销/超市大促销.png new file mode 100644 index 0000000..fefddbc Binary files /dev/null and b/第10讲超市大促销/超市大促销.png differ diff --git a/第11讲奖品到谁家/11奖品到谁家讲义.pdf b/第11讲奖品到谁家/11奖品到谁家讲义.pdf new file mode 100644 index 0000000..8d6ed60 Binary files /dev/null and b/第11讲奖品到谁家/11奖品到谁家讲义.pdf differ diff --git a/第11讲奖品到谁家/奖品到谁家.png b/第11讲奖品到谁家/奖品到谁家.png new file mode 100644 index 0000000..266db0e Binary files /dev/null and b/第11讲奖品到谁家/奖品到谁家.png differ diff --git a/第11讲奖品到谁家/课堂成果/奖品到谁家.py b/第11讲奖品到谁家/课堂成果/奖品到谁家.py new file mode 100644 index 0000000..c3bcdad --- /dev/null +++ b/第11讲奖品到谁家/课堂成果/奖品到谁家.py @@ -0,0 +1,18 @@ +import random +price = int(input("请输入您购买的商品总额,判定您是否有抽奖资格:")) +if price >= 300: + print("......开始抽奖......") + number = random.randint(1,10) + print(number) + if number == 1: + print("一等奖:编程机器人") + elif number == 2 or number == 3: + print("二等奖:超大毛绒玩具熊") + elif number == 4 or number == 5: + print("三等奖:磁悬浮地球仪") + elif number == 6 or number == 7: + print("四等奖:三阶魔方") + else: + print("参与奖:抽纸一包") +else: + print(f"总价{price}不符合抽奖要求") \ No newline at end of file diff --git a/第12讲特工身份确认/12特工身份确认讲义.pdf b/第12讲特工身份确认/12特工身份确认讲义.pdf new file mode 100644 index 0000000..b5829b9 Binary files /dev/null and b/第12讲特工身份确认/12特工身份确认讲义.pdf differ diff --git a/第12讲特工身份确认/特工身份确认.png b/第12讲特工身份确认/特工身份确认.png new file mode 100644 index 0000000..9f1183b Binary files /dev/null and b/第12讲特工身份确认/特工身份确认.png differ diff --git a/第12讲特工身份确认/课堂成果/特工身份确认.py b/第12讲特工身份确认/课堂成果/特工身份确认.py new file mode 100644 index 0000000..9c0cbeb --- /dev/null +++ b/第12讲特工身份确认/课堂成果/特工身份确认.py @@ -0,0 +1,14 @@ +while True: + username = input('请输入您的代号:') + password = input('请输入您的密码:') + + # 检查用户名和密码是否正确 + if username == '007' and password == '妈咪妈咪哄': + print('登录成功!') + break + if username != '007': + print('代号错误!请重新输入') + continue + if password != '妈咪妈咪哄': + print('密码记错了吧!请重新输入') +print('特工007,欢迎回家') \ No newline at end of file diff --git a/第12讲特工身份确认/课堂成果/课后作业_猜猜我心里的数字.py b/第12讲特工身份确认/课堂成果/课后作业_猜猜我心里的数字.py new file mode 100644 index 0000000..94c6b89 --- /dev/null +++ b/第12讲特工身份确认/课堂成果/课后作业_猜猜我心里的数字.py @@ -0,0 +1,6 @@ +guess_number = 56 +while True: + num = int(input("猜猜我心里的数字是(1-100之间):")) + if num == guess_number: + break +print("终于找到你了!") \ No newline at end of file diff --git a/第13讲派发特工任务/13派发特工任务讲义.pdf b/第13讲派发特工任务/13派发特工任务讲义.pdf new file mode 100644 index 0000000..01bd6bd Binary files /dev/null and b/第13讲派发特工任务/13派发特工任务讲义.pdf differ diff --git a/第13讲派发特工任务/派发特工任务.png b/第13讲派发特工任务/派发特工任务.png new file mode 100644 index 0000000..c87eb25 Binary files /dev/null and b/第13讲派发特工任务/派发特工任务.png differ diff --git a/第13讲派发特工任务/课堂成果/派发特工任务.py b/第13讲派发特工任务/课堂成果/派发特工任务.py new file mode 100644 index 0000000..a92dce7 --- /dev/null +++ b/第13讲派发特工任务/课堂成果/派发特工任务.py @@ -0,0 +1,25 @@ +# 请在这里编写代码 +name = ['黄昏', '黎明', '007', '萧炎', '唐三'] + +task = ['潜入敌国获取情报', + '采摘生长在天山的雪莲花', + '给隔壁出差李阿姨家的喵喵加粮', + '营救被扣押的人质', + '破解电脑系统获取目标数据'] + +# 007通过密钥2获取相应的任务信息(访问列表元素) +task_007 = task[2] + +print("007的特工任务:" + task_007) +print() + +# 获取特工列表长度 +print('共有特工' + str(len(name)) + '名') +# 长官要看到每位特工的任务详情 +for i in range(len(name)): + print(name[i] + "的特工任务:" + task[i]) +print() + +# “萧炎”和“唐三”特工合作完成任务(列表的切片) +task_together = task[3:] +print(task_together) diff --git a/第13讲派发特工任务/课堂成果/课后作业_水果舞会.py b/第13讲派发特工任务/课堂成果/课后作业_水果舞会.py new file mode 100644 index 0000000..e1df0c3 --- /dev/null +++ b/第13讲派发特工任务/课堂成果/课后作业_水果舞会.py @@ -0,0 +1,8 @@ +#请在这里编写代码 +fruit = ["苹果", "香蕉", "橙子", "草莓", "葡萄", "樱桃"] + +fruit1 = fruit[1:4] +fruit2 = fruit[::2] + +print(fruit1) +print(fruit2) diff --git a/第14讲任务进行时/14任务进行时讲义.pdf b/第14讲任务进行时/14任务进行时讲义.pdf new file mode 100644 index 0000000..1b32892 Binary files /dev/null and b/第14讲任务进行时/14任务进行时讲义.pdf differ diff --git a/第14讲任务进行时/任务进行时.png b/第14讲任务进行时/任务进行时.png new file mode 100644 index 0000000..e024198 Binary files /dev/null and b/第14讲任务进行时/任务进行时.png differ diff --git a/第14讲任务进行时/课堂成果/任务进行时.py b/第14讲任务进行时/课堂成果/任务进行时.py new file mode 100644 index 0000000..2907859 --- /dev/null +++ b/第14讲任务进行时/课堂成果/任务进行时.py @@ -0,0 +1,28 @@ +#请在这里编写代码 +name = ['黄昏','黎明','007','萧炎','唐三'] +task = ['潜入敌国获取情报', + '采摘生长在天山的雪莲花', + '给隔壁出差李阿姨家的喵喵加粮', + '营救被扣押的人质', + '破解电脑系统获取目标数据'] + +skill = input("请使用特工技能(1.跳跃;2.隐匿;3.射击):") +if skill == '1': + print('成功进入李阿姨的院子') + skill = input('请使用特工技能(1.跳跃;2.隐匿;3.射击):') + if skill == '2': + print('成功加粮') + # 方法一:删除指定元素,指定索引位置添加元素 + task.pop(2) + task.insert(2,'抢回被夺走的特工名单') + # 方法二:修改列表元素 + # task[2] = '抢回被夺走的特工名单' + print(task) +elif skill == '2': + print('无法进入院子') +elif skill == '3': + print('任务失败,被组织除名') + name.pop(2) # 或者name.remove('007'),或者del name[2] + print(name) +else: + print('请正确输入技能编号') diff --git a/第14讲任务进行时/课堂成果/课后作业_兔子长官.py b/第14讲任务进行时/课堂成果/课后作业_兔子长官.py new file mode 100644 index 0000000..f0b6a0c --- /dev/null +++ b/第14讲任务进行时/课堂成果/课后作业_兔子长官.py @@ -0,0 +1,8 @@ +#请在这里编写代码 +animals = ["猴子", "小花猪", "蝴蝶", "豹子"] +#animals.pop() +#del animals[3] +animals.remove('豹子') +animals.insert(1,"大象") +animals.append('绵羊') +print(animals) diff --git a/第15讲特工大危机/15特工大危机讲义.pdf b/第15讲特工大危机/15特工大危机讲义.pdf new file mode 100644 index 0000000..0e507c4 Binary files /dev/null and b/第15讲特工大危机/15特工大危机讲义.pdf differ diff --git a/第15讲特工大危机/特工大危机.png b/第15讲特工大危机/特工大危机.png new file mode 100644 index 0000000..e967a51 Binary files /dev/null and b/第15讲特工大危机/特工大危机.png differ diff --git a/第15讲特工大危机/课堂成果/特工大危机.py b/第15讲特工大危机/课堂成果/特工大危机.py new file mode 100644 index 0000000..af03bdb --- /dev/null +++ b/第15讲特工大危机/课堂成果/特工大危机.py @@ -0,0 +1,15 @@ +# 名单在争抢中被撕成两份,需要先修复特工名单 +tup1 = ('黄昏','黎明','007') +tup2 = ('萧炎','唐三') +tup_all = tup1 + tup2 + +# 加密(字符串、切片) +key = "ay" +list_all = [] +for name in tup_all: + first = name[0] + last = name[1:] + new_name = last + first + key + list_all.append(new_name) +new_tup = tuple(list_all) +print(new_tup) diff --git a/第15讲特工大危机/课堂成果/课后作业_颁奖典礼.py b/第15讲特工大危机/课堂成果/课后作业_颁奖典礼.py new file mode 100644 index 0000000..4102540 --- /dev/null +++ b/第15讲特工大危机/课堂成果/课后作业_颁奖典礼.py @@ -0,0 +1,8 @@ +tup = ("迪迦", "赛文", "佐菲", "戴拿") +key = "同学" +lst = [] +for name in tup: + new_name = name + key + lst.append(new_name) +new_tup = tuple(lst) +print(new_tup) diff --git a/第16讲特工密语大全/16特工密语大全讲义.pdf b/第16讲特工密语大全/16特工密语大全讲义.pdf new file mode 100644 index 0000000..4a10256 Binary files /dev/null and b/第16讲特工密语大全/16特工密语大全讲义.pdf differ diff --git a/第16讲特工密语大全/特工密语大全.png b/第16讲特工密语大全/特工密语大全.png new file mode 100644 index 0000000..39b7ce3 Binary files /dev/null and b/第16讲特工密语大全/特工密语大全.png differ diff --git a/第16讲特工密语大全/课堂成果/密语文件.py b/第16讲特工密语大全/课堂成果/密语文件.py new file mode 100644 index 0000000..da33196 --- /dev/null +++ b/第16讲特工密语大全/课堂成果/密语文件.py @@ -0,0 +1,16 @@ +# 顶级特工007写了一本《特工密语大全》,在特工中广为流传,他会实时对书中的内容进行修改 +handbook = ['宫廷玉液酒,一百八一杯','你是我的兄弟','天王盖地虎,小猫抓老鼠','明月几时有,抬头自己瞅','给你点赞'] + +# 最近特工密语“你是我的兄弟”被敌人破解了,需要从《特工密语大全》中删除 +handbook.remove('你是我的兄弟') + +# 特工们的密语也需要紧跟时代,最近流行一种新的密语“不可能!绝对不可能”,要及时加入《密语大全》 +handbook.append('不可能!绝对不可能') + +# 接到上头通知,从前用的密语“给你点赞”要更新为“你真是泰酷辣”,需要及时更新替换 +for i in range (len(handbook)): + if handbook[i] == '给你点赞': + handbook[i] = '你真是泰酷辣' + +# 输出最新的《特工密语大全》 +print(handbook) diff --git a/第17讲神秘的宝藏/17神秘的宝藏讲义.pdf b/第17讲神秘的宝藏/17神秘的宝藏讲义.pdf new file mode 100644 index 0000000..edee1e3 Binary files /dev/null and b/第17讲神秘的宝藏/17神秘的宝藏讲义.pdf differ diff --git a/第17讲神秘的宝藏/神秘的宝藏.png b/第17讲神秘的宝藏/神秘的宝藏.png new file mode 100644 index 0000000..a7c2f2e Binary files /dev/null and b/第17讲神秘的宝藏/神秘的宝藏.png differ diff --git a/第17讲神秘的宝藏/课堂成果/神秘的宝藏.py b/第17讲神秘的宝藏/课堂成果/神秘的宝藏.py new file mode 100644 index 0000000..ed10a2b --- /dev/null +++ b/第17讲神秘的宝藏/课堂成果/神秘的宝藏.py @@ -0,0 +1,26 @@ +# 3张藏宝图中的4个关键信息 +map1 = {1:'女儿出嫁(打一字)',2:'向西走,回头看(打一方向)'} +map2 = {3:'由外西北广,于代宝玉来(打一地方)'} +map3 = {4:'一个字,八个头,里面有水不外流(打一字)'} +# 串联所有的藏宝图信息,都存储在map1中 +map1.update(map2) +map1.update(map3) +# 输出所有的谜题 +print('''----开启宝藏的方法---- +下面谜底连在一起为宝藏之谜 +--------------------------''') +# 遍历字典的值,输出所有谜题 +for i in map1.values(): + print(i) +# 挨个询问谜底 +ans1 = input('请猜测第一个谜底:') +ans2 = input('请猜测第二个谜底:') +ans3 = input('请猜测第三个谜底:') +ans4 = input('请猜测第四个谜底:') +# 如果谜底全部正确,则输出正确的藏宝地 +if ans1 == '家' and ans2 == '东侧' and ans3 == '庙宇' and ans4 == '井': + print('''**** 恭喜你 **** +成功解开了宝藏之谜''') + print('宝藏位于:家东侧庙宇的井中') +else: + print('你所猜测的地方没有宝藏') \ No newline at end of file diff --git a/第17讲神秘的宝藏/课堂成果/课后作业_我的小超市.py b/第17讲神秘的宝藏/课堂成果/课后作业_我的小超市.py new file mode 100644 index 0000000..c8c0193 --- /dev/null +++ b/第17讲神秘的宝藏/课堂成果/课后作业_我的小超市.py @@ -0,0 +1,8 @@ +shop = { '牛奶':10, '辣条':10, '方便面':8, '火腿肠':8 } +shop['方便面'] = 4 +shop['火腿肠'] = 4 +print(shop) +shop['面包'] = 5 +print(shop) +for i in shop: + print(i) \ No newline at end of file diff --git a/第18讲私人通讯录/18私人通讯录讲义.pdf b/第18讲私人通讯录/18私人通讯录讲义.pdf new file mode 100644 index 0000000..b3f231b Binary files /dev/null and b/第18讲私人通讯录/18私人通讯录讲义.pdf differ diff --git a/第18讲私人通讯录/私人通讯录.png b/第18讲私人通讯录/私人通讯录.png new file mode 100644 index 0000000..f39c2f3 Binary files /dev/null and b/第18讲私人通讯录/私人通讯录.png differ diff --git a/第18讲私人通讯录/课堂成果/私人通讯录.py b/第18讲私人通讯录/课堂成果/私人通讯录.py new file mode 100644 index 0000000..1c1bbed --- /dev/null +++ b/第18讲私人通讯录/课堂成果/私人通讯录.py @@ -0,0 +1,38 @@ +print('--- 欢迎进入我的私人通讯录 ---') +print('--- 1:查询、修改 ---') +print('--- 2:新增联系人 ---') +print('--- 3:删除联系人 ---') +print('--- 4:退出通讯录 ---') +phone = {'大强':'13111111111', '爸爸':'15735199988'} + +# 无限循环通讯录的操作 +while True: + num = int(input('请输入相关操作数字代号:')) + # 如果输入数字1,则查询指定联系人电话,如果联系人存在,则询问是否修改联系人电话 + if num == 1: + name = input('请输入联系人姓名:') + if name in phone: + print(name + ' : ' + phone[name]) + if input('是否修改联系人电话(YES/NO):') == 'YES': + phone[name] = input('请输入联系人新电话:') + else: + print('您输入的姓名不在通讯录中!') + # 如果输入数字2,则查询该联系人是否在通讯录,如果不在,则新建 + if num == 2: + name = input('请输入联系人姓名:') + if name in phone: + print('您输入的姓名在通讯录中已存在') + print(name + ' : ' + phone[name]) + else: + phone[name] = input('请输入联系人电话:') + # 如果输入数字3,则删除对应联系人的键值对 + if num == 3: + name = input('请输入联系人姓名:') + if name in phone: + del phone[name] + else: + print('您输入的联系人不存在') + # 如果输入数字4,则跳出整个循环,停止使用通讯录 + if num == 4: + break +print('---- 感谢使用私人通讯录 ----') \ No newline at end of file diff --git a/第18讲私人通讯录/课堂成果/课堂作业_宠物乐园.py b/第18讲私人通讯录/课堂成果/课堂作业_宠物乐园.py new file mode 100644 index 0000000..81830ef --- /dev/null +++ b/第18讲私人通讯录/课堂成果/课堂作业_宠物乐园.py @@ -0,0 +1,7 @@ +pet_park = {"Tom":"鱼干","Jerry":"奶酪","Buddy":"罐头","Lucky":"骨头"} +if 'Buddy' in pet_park: + print('Buddy喜欢的食物是:' + pet_park['Buddy']) +else: + print('Buddy 不在宠物乐园') +del pet_park['Tom'] +print(pet_park) diff --git a/第18讲私人通讯录/课堂成果/隐藏任务.py b/第18讲私人通讯录/课堂成果/隐藏任务.py new file mode 100644 index 0000000..01a6b43 --- /dev/null +++ b/第18讲私人通讯录/课堂成果/隐藏任务.py @@ -0,0 +1,42 @@ +print('--- 欢迎进入我的私人通讯录 ---') +print('--- 1:查询、修改 ---') +print('--- 2:新增联系人 ---') +print('--- 3:删除联系人 ---') +print('--- 4:退出通讯录 ---') +phone = {'大强':'13111111111', '爸爸':'15735199988'} + +# 无限循环通讯录的操作 +while True: + num = int(input('请输入相关操作数字代号:')) + # 如果输入数字1,则查询指定联系人电话,如果联系人存在,则询问是否修改联系人电话 + if num == 1: + name = input('请输入联系人姓名:') + if name in phone: + print(name + ' : ' + phone[name]) + if input('是否修改联系人电话(YES/NO):') == 'YES': + phone[name] = input('请输入联系人新电话:') + else: + print('您输入的姓名不在通讯录中!') + # 如果输入数字2,则查询该联系人是否在通讯录,如果不在,则新建 + if num == 2: + name = input('请输入联系人姓名:') + if name in phone: + print('您输入的姓名在通讯录中已存在') + print(name + ' : ' + phone[name]) + else: + phone[name] = input('请输入联系人电话:') + # 如果输入数字3,则删除对应联系人的键值对 + if num == 3: + name = input('请输入联系人姓名:') + if name in phone: + del phone[name] + else: + print('您输入的联系人不存在') + # 如果输入数字4,则跳出整个循环,停止使用通讯录 + if num == 4: + break + # 隐藏任务(选做):如果输入0,则可以查看完整的通讯录 + if num == 0: + for key,value in phone.items(): + print(key,value,sep = ':') +print('---- 感谢使用私人通讯录 ----') \ No newline at end of file diff --git a/第19讲王者荣耀化妆舞会/19王者荣耀化妆舞会讲义.pdf b/第19讲王者荣耀化妆舞会/19王者荣耀化妆舞会讲义.pdf new file mode 100644 index 0000000..b7a7162 Binary files /dev/null and b/第19讲王者荣耀化妆舞会/19王者荣耀化妆舞会讲义.pdf differ diff --git a/第19讲王者荣耀化妆舞会/王者荣耀化妆舞会.png b/第19讲王者荣耀化妆舞会/王者荣耀化妆舞会.png new file mode 100644 index 0000000..93d9274 Binary files /dev/null and b/第19讲王者荣耀化妆舞会/王者荣耀化妆舞会.png differ diff --git a/第19讲王者荣耀化妆舞会/课堂成果/拓展挑战_集合运算.py b/第19讲王者荣耀化妆舞会/课堂成果/拓展挑战_集合运算.py new file mode 100644 index 0000000..0a06346 --- /dev/null +++ b/第19讲王者荣耀化妆舞会/课堂成果/拓展挑战_集合运算.py @@ -0,0 +1,17 @@ +import random +set1 = set() +set2 = set() +for i in range(5): + set1.add(random.randint(1,10)) + set2.add(random.randint(1,10)) +print(set1) +print(set2) +common = set1.intersection(set2) +print(common) +own_1 = set1.difference(set2) +print(own_1) +own_2 = set2.difference(set1) +print(own_2) +all_set = set1.union(set2) +print(all_set) + diff --git a/第19讲王者荣耀化妆舞会/课堂成果/王者荣耀签到表.py b/第19讲王者荣耀化妆舞会/课堂成果/王者荣耀签到表.py new file mode 100644 index 0000000..c670b79 --- /dev/null +++ b/第19讲王者荣耀化妆舞会/课堂成果/王者荣耀签到表.py @@ -0,0 +1,26 @@ +# 三人列出各自的好友签到表 +pzai = {'马里奥','狗蛋','二丫','冠冠','卡卡'} +xiaoE = {'静静','铁柱','米粒','瞳瞳','嘟嘟'} +boks = {'小奶酪','倩倩','冠冠','卡卡','轩轩'} + +# pzai和boks有一些共同的好友,请找出这些共同好友,防止重复邀请 +common = pzai.intersection(boks) +print(common) + +# 有一些是独属于pzai、boks的朋友,请找出这些朋友 +own_p = pzai.difference(boks) +print(own_p) +own_b = boks.difference(pzai) +print(own_b) + +# 将所有人的好友都写在一张签到表上,注意不重不漏 +set1 = pzai.union(boks) +all_set = set1.union(xiaoE) +print(all_set) + +# 舞会的前两天,收到大家的信息,“卡卡”临时有事无法到场,“小叶子”听说活动主动报名想要参加,所以需要对签到表进行调整 +all_set.remove('卡卡') +all_set.add('小叶子') +print('————签到表————') +for i in all_set: + print(i) diff --git a/第19讲王者荣耀化妆舞会/课堂成果/课后作业_火眼金晶.py b/第19讲王者荣耀化妆舞会/课堂成果/课后作业_火眼金晶.py new file mode 100644 index 0000000..1ec80c6 --- /dev/null +++ b/第19讲王者荣耀化妆舞会/课堂成果/课后作业_火眼金晶.py @@ -0,0 +1,5 @@ +str1 = 'apple' +str2 = 'banana' +str_all = str1 + str2 +set_all = set(str_all) +print(len(set_all)) diff --git a/第1讲初识python/01初识python讲义.pdf b/第1讲初识python/01初识python讲义.pdf new file mode 100644 index 0000000..b1f117d Binary files /dev/null and b/第1讲初识python/01初识python讲义.pdf differ diff --git a/第1讲初识python/初识python.png b/第1讲初识python/初识python.png new file mode 100644 index 0000000..11f6741 Binary files /dev/null and b/第1讲初识python/初识python.png differ diff --git a/第1讲初识python/课堂成果/小小闹钟.py b/第1讲初识python/课堂成果/小小闹钟.py new file mode 100644 index 0000000..94cf16f --- /dev/null +++ b/第1讲初识python/课堂成果/小小闹钟.py @@ -0,0 +1,15 @@ +''' +p仔的闹钟是个淘气鬼, +每天都变着法子叫p仔起床, +今天,它又换了新的唤醒服务~ + +5次提醒后,p仔终于从床上爬了起来。 +同学们,试着用print()打印出闹钟的铃声内容吧! +(悄悄说一句,可以自己更改铃声内容,一般人我不告诉他) +''' + +print("懒虫,懒虫,快起床!太阳晒到屁股啦!") +print("懒虫,懒虫,快起床!太阳晒到屁股啦!") +print("懒虫,懒虫,快起床!早饭要被吃光啦!") +print("懒虫,懒虫,快起床!上学马上迟到啦!") +print("懒虫,懒虫,快起床!妈妈要来打屁股啦!") \ No newline at end of file diff --git a/第1讲初识python/课堂成果/让大家记住你.py b/第1讲初识python/课堂成果/让大家记住你.py new file mode 100644 index 0000000..ea3c628 --- /dev/null +++ b/第1讲初识python/课堂成果/让大家记住你.py @@ -0,0 +1,9 @@ +''' + 使用print()函数打印自我介绍,可以介绍自己的姓名、爱好、才艺等, + 目的是让大家记住你。记得添上恰当的注释哦! +''' + +print("嗨,大家好,我叫大强!") #介绍自己的姓名 +print("我是一个真ikun,喜欢唱跳rap和篮球。") #介绍自己的爱好 +print("music~") #开始展示 +print("┗|`O′|┛") \ No newline at end of file diff --git a/第1讲初识python/课堂成果/课后作业_绕口令.py b/第1讲初识python/课堂成果/课后作业_绕口令.py new file mode 100644 index 0000000..343e480 --- /dev/null +++ b/第1讲初识python/课堂成果/课后作业_绕口令.py @@ -0,0 +1,11 @@ +''' +(1)使用print函数,打印出这个4行绕口令 +(2)在程序的最开始添加注释,介绍绕口令的题目《捉兔》 +(3)将这个程序保存下来 +''' + +#《捉兔》 +print('一位爷爷他姓顾,上街打醋又买布') +print('买了布,打了醋,回头看见鹰抓兔') +print('放下布,搁下醋,上前去追鹰和兔') +print('飞了鹰,跑了兔,打翻醋,醋湿布') diff --git a/第20讲巅峰对决/20巅峰对决讲义.pdf b/第20讲巅峰对决/20巅峰对决讲义.pdf new file mode 100644 index 0000000..be6e840 Binary files /dev/null and b/第20讲巅峰对决/20巅峰对决讲义.pdf differ diff --git a/第20讲巅峰对决/巅峰对决.png b/第20讲巅峰对决/巅峰对决.png new file mode 100644 index 0000000..cbfa9e0 Binary files /dev/null and b/第20讲巅峰对决/巅峰对决.png differ diff --git a/第20讲巅峰对决/课堂成果/巅峰对决.py b/第20讲巅峰对决/课堂成果/巅峰对决.py new file mode 100644 index 0000000..e6c7902 --- /dev/null +++ b/第20讲巅峰对决/课堂成果/巅峰对决.py @@ -0,0 +1,35 @@ +# 字典:王者show(英雄和台词一一对应) +actor = {'钟馗':'沧海桑田,唯混沌与破烂源源不断', + '李白':'将进酒,杯莫停', + '甄姬':'人家抒发哀伤时,不要随便破坏氛围好吗?', + '百里守约':'路过草丛的熟人,以子弹礼貌招呼!', + '铠':'比任何对手都强,乃人生最大的烦恼'} +for i in range(len(actor)): + key = input('*欢迎今天到场的英雄*:') + if key in actor.keys(): + print(actor[key]) + else: + print('报幕错误,show搞砸了!') + break + +# 元组:王者队伍初组成(五人一队,英雄可重复选用,英雄选定不可更改) +team1 = ('钟馗','李白','百里守约','甄姬','项羽') +team2 = ('周瑜','曹操','鲁班七号','铠','妲己') + +# 列表:LiBai和Kai同台竞技 +LiBai = ['侠客行','将进酒','神来之笔','青莲剑歌'] +Kai = ['修罗之魂','极刃风暴','回旋之刃','不灭魔躯'] + +# 集合:化妆舞会好友圈 +my_set = set() +while True: + choice = input('请选择你的操作,1.关注;2.取关;3.退出好友圈:') + if choice == '1': + in_name = input('请问你要关注谁:') + my_set.add(in_name) + if choice == '2': + out_name = input('请问你要取关谁:') + my_set.remove(out_name) + if choice == '3': + break +print(my_set) \ No newline at end of file diff --git a/第20讲巅峰对决/课堂成果/课后作业_珠宝商人.py b/第20讲巅峰对决/课堂成果/课后作业_珠宝商人.py new file mode 100644 index 0000000..fabf7a4 --- /dev/null +++ b/第20讲巅峰对决/课堂成果/课后作业_珠宝商人.py @@ -0,0 +1,19 @@ +'''珠宝商人 + +假设你是一家珠宝店的老板,用名为 jewelry 的字典存储了珠宝的相关信息。现在,你想要查看一款珠宝的价格,请编写一个程序输出该珠宝的价格。 + +编写一段代码,要求如下: + +已知 jewelry={"项链":1000,"戒指":2000,"手链":1500} + +(1) 输入要查价格的珠宝名称,并存储在 name 变量中 + +(2) 用 price 变量存储查询到的价格 + +(3) 输出:'珠宝名称'的价格是'××' + + ''' +jewelry = {"项链": 1000, "戒指": 2000, "手链": 1500} +name = input("请输入要查价格的珠宝名称:") +price = jewelry[name] +print(name + "的价格是" + str(price)) \ No newline at end of file diff --git a/第21讲你好炸鸡店/21你好炸鸡店讲义.pdf b/第21讲你好炸鸡店/21你好炸鸡店讲义.pdf new file mode 100644 index 0000000..54e5b64 Binary files /dev/null and b/第21讲你好炸鸡店/21你好炸鸡店讲义.pdf differ diff --git a/第21讲你好炸鸡店/你好炸鸡店.png b/第21讲你好炸鸡店/你好炸鸡店.png new file mode 100644 index 0000000..66158dc Binary files /dev/null and b/第21讲你好炸鸡店/你好炸鸡店.png differ diff --git a/第21讲你好炸鸡店/课堂成果/你好炸鸡店.py b/第21讲你好炸鸡店/课堂成果/你好炸鸡店.py new file mode 100644 index 0000000..e747efd --- /dev/null +++ b/第21讲你好炸鸡店/课堂成果/你好炸鸡店.py @@ -0,0 +1,33 @@ +'''请帮炸鸡店老板做一个点餐系统,店内的商品、价格已经存储在menu字典中,输入商品名称和数量,打印顾客的小票,算出消费总额。 + +已知: + +menu = {'香辣鸡腿堡':19.5,'劲爆鸡米花':12,'黄金鸡块':12.5,'香辣鸡翅':12.5,'香甜玉米杯':9,'醇香土豆泥':7.5,'薯条':9,'秘汁全鸡':29.9,'百事可乐':8.5} + +提示如下: + +(1) 输出商品菜单 menu + +(2) 创建空字典 total 、创建变量 price,初始化为0 + +(3) 输入购买的商品名称、数量 + +(4) 更新商品总额 price + +(5) 将购买的商品及数量添加到字典 total + +(6) 输出购物小票 total,输出消费总额 price + + ''' +menu = {'香辣鸡腿堡':19.5,'劲爆鸡米花':12,'黄金鸡块':12.5,'香辣鸡翅':12.5, + '香甜玉米杯':9,'醇香土豆泥':7.5,'薯条':9,'秘汁全鸡':29.9,'百事可乐':8.5} +print(menu) +total = {} +price = 0 +while True: + food = input('请输入商品名称:') + num = int(input('请输入商品数量:')) + price = price + menu[food] * num + total[food] = num + print(total) + print(price) \ No newline at end of file diff --git a/第22讲我的地盘说我的话/22我的地盘说我的话讲义.pdf b/第22讲我的地盘说我的话/22我的地盘说我的话讲义.pdf new file mode 100644 index 0000000..40de76c Binary files /dev/null and b/第22讲我的地盘说我的话/22我的地盘说我的话讲义.pdf differ diff --git a/第22讲我的地盘说我的话/我的地盘说我的话.png b/第22讲我的地盘说我的话/我的地盘说我的话.png new file mode 100644 index 0000000..68f6432 Binary files /dev/null and b/第22讲我的地盘说我的话/我的地盘说我的话.png differ diff --git a/第22讲我的地盘说我的话/课堂成果/我的地盘我说话.py b/第22讲我的地盘说我的话/课堂成果/我的地盘我说话.py new file mode 100644 index 0000000..89c4d49 --- /dev/null +++ b/第22讲我的地盘说我的话/课堂成果/我的地盘我说话.py @@ -0,0 +1,10 @@ +# 来我的地盘,说我的话(进制转换器) +import random + +print('这里是二进制部落。来我的地盘,说我的话!') +question = random.randint(1,100) +answer = input(f'十进制数{question}转换为:') +if answer == bin(question): + print('亲爱的友人,欢迎来到二进制部落') +else: + print('你在胡言乱语什么!来人,把他赶出去!') \ No newline at end of file diff --git a/第23讲多彩图形争霸赛(一)/23多彩图形争霸赛(一)讲义.pdf b/第23讲多彩图形争霸赛(一)/23多彩图形争霸赛(一)讲义.pdf new file mode 100644 index 0000000..82b3b33 Binary files /dev/null and b/第23讲多彩图形争霸赛(一)/23多彩图形争霸赛(一)讲义.pdf differ diff --git a/第23讲多彩图形争霸赛(一)/多彩图形争霸赛(一).png b/第23讲多彩图形争霸赛(一)/多彩图形争霸赛(一).png new file mode 100644 index 0000000..aa6ecbc Binary files /dev/null and b/第23讲多彩图形争霸赛(一)/多彩图形争霸赛(一).png differ diff --git a/第23讲多彩图形争霸赛(一)/课堂成果/starbg.png b/第23讲多彩图形争霸赛(一)/课堂成果/starbg.png new file mode 100644 index 0000000..68c7b26 Binary files /dev/null and b/第23讲多彩图形争霸赛(一)/课堂成果/starbg.png differ diff --git a/第23讲多彩图形争霸赛(一)/课堂成果/多彩图形争霸赛_一.py b/第23讲多彩图形争霸赛(一)/课堂成果/多彩图形争霸赛_一.py new file mode 100644 index 0000000..97abbcd --- /dev/null +++ b/第23讲多彩图形争霸赛(一)/课堂成果/多彩图形争霸赛_一.py @@ -0,0 +1,26 @@ +import turtle as t + +def side3(): + for i in range(3): + t.forward(80) + t.left(120) + +def side4(): + for i in range(4): + t.forward(40) + t.left(90) + +t.setup(960,720) +t.bgpic('starbg.png') +t.pensize(5) +t.fillcolor('yellow') +t.begin_fill() +for i in range(5): + side3() + t.forward(80) + side4() + t.goto(0,0) + t.left(72) +t.end_fill() +t.done() + diff --git a/第23讲多彩图形争霸赛(一)/课堂成果/课后作业_六边形.py b/第23讲多彩图形争霸赛(一)/课堂成果/课后作业_六边形.py new file mode 100644 index 0000000..4537fc5 --- /dev/null +++ b/第23讲多彩图形争霸赛(一)/课堂成果/课后作业_六边形.py @@ -0,0 +1,9 @@ +import turtle as t +def side6(): + for i in range(6): + t.forward(100) + t.right(60) +for i in range(6): + side6() + t.right(60) +t.done() \ No newline at end of file diff --git a/第24讲多彩图形争霸赛(二)/24多彩图形争霸赛(二)讲义.pdf b/第24讲多彩图形争霸赛(二)/24多彩图形争霸赛(二)讲义.pdf new file mode 100644 index 0000000..87c15ee Binary files /dev/null and b/第24讲多彩图形争霸赛(二)/24多彩图形争霸赛(二)讲义.pdf differ diff --git a/第24讲多彩图形争霸赛(二)/多彩图形争霸赛(二).png b/第24讲多彩图形争霸赛(二)/多彩图形争霸赛(二).png new file mode 100644 index 0000000..c19cf5b Binary files /dev/null and b/第24讲多彩图形争霸赛(二)/多彩图形争霸赛(二).png differ diff --git a/第24讲多彩图形争霸赛(二)/课堂成果/视觉漩涡.py b/第24讲多彩图形争霸赛(二)/课堂成果/视觉漩涡.py new file mode 100644 index 0000000..4537fc5 --- /dev/null +++ b/第24讲多彩图形争霸赛(二)/课堂成果/视觉漩涡.py @@ -0,0 +1,9 @@ +import turtle as t +def side6(): + for i in range(6): + t.forward(100) + t.right(60) +for i in range(6): + side6() + t.right(60) +t.done() \ No newline at end of file diff --git a/第24讲多彩图形争霸赛(二)/课堂成果/课后作业_加法运算器.py b/第24讲多彩图形争霸赛(二)/课堂成果/课后作业_加法运算器.py new file mode 100644 index 0000000..e907184 --- /dev/null +++ b/第24讲多彩图形争霸赛(二)/课堂成果/课后作业_加法运算器.py @@ -0,0 +1,15 @@ +'''加法计算器 + +制作一个加法计算器。将加数1、加数2作为参数,返回计算结果。 + +编写一段代码,要求如下: + +(1) 定义有参函数 + +(2) 返回计算结果 + +(3) 输出函数的返回值''' +def my_add(a,b): + c = a + b + return c +print(my_add(2,3)) \ No newline at end of file diff --git a/第25讲冠军的即兴show/25冠军的即兴show讲义.pdf b/第25讲冠军的即兴show/25冠军的即兴show讲义.pdf new file mode 100644 index 0000000..125cd77 Binary files /dev/null and b/第25讲冠军的即兴show/25冠军的即兴show讲义.pdf differ diff --git a/第25讲冠军的即兴show/冠军的即兴show.png b/第25讲冠军的即兴show/冠军的即兴show.png new file mode 100644 index 0000000..2520dea Binary files /dev/null and b/第25讲冠军的即兴show/冠军的即兴show.png differ diff --git a/第25讲冠军的即兴show/课堂成果/炫彩动图.py b/第25讲冠军的即兴show/课堂成果/炫彩动图.py new file mode 100644 index 0000000..9b72883 --- /dev/null +++ b/第25讲冠军的即兴show/课堂成果/炫彩动图.py @@ -0,0 +1,29 @@ +import turtle as t +import colorsys + +# 绘制平行四边形 +def pingxing(): + for j in range(2): + t.forward(100) + t.right(60) + t.forward(200) + t.right(120) + +t.tracer(10) +t.bgcolor('black') +t.pensize(3) +h = 0 + +while True: + c = colorsys.hsv_to_rgb(h,1,1) + h += 0.005 + if h > 1 : + h = 0 + t.pencolor(c) + t.fillcolor('black') + t.begin_fill() + pingxing() + t.end_fill() + t.right(12) + +t.done() diff --git a/第25讲冠军的即兴show/课堂成果/课后作业一_多样选炫彩动图.py b/第25讲冠军的即兴show/课堂成果/课后作业一_多样选炫彩动图.py new file mode 100644 index 0000000..fe016ea --- /dev/null +++ b/第25讲冠军的即兴show/课堂成果/课后作业一_多样选炫彩动图.py @@ -0,0 +1,59 @@ +'''选择绘制五角星、三角形、正方形或者线条等函数,用相同的方法完成自己的炫彩动图。''' +import turtle as t +import colorsys + + +# 绘制线条 +def line(): + t.forward(200) + t.forward(-200) + + +# 绘制三角形 +def side3(): + for i in range(3): + t.fd(100) + t.lt(120) + + +# 绘制正方形 +def side4(): + for i in range(4): + t.fd(100) + t.lt(90) + + +# 绘制五角星 +def star(): + for i in range(5): + t.fd(100) + t.rt(144) + + +# 绘制平行四边形 +def pingxing(): + for j in range(2): + t.fd(100) + t.rt(60) + t.fd(200) + t.rt(120) + + +t.tracer(10) +t.bgcolor('black') +t.pensize(3) +h = 0 + +while True: + c = colorsys.hsv_to_rgb(h, 1, 1) + h += 0.005 + if h > 1: + h = 0 + t.pencolor(c) + t.fillcolor('black') + t.begin_fill() + star() # 调用上述任一函数绘制基础图案即可 + t.end_fill() + t.rt(12) + +t.done() diff --git a/第25讲冠军的即兴show/课堂成果/课后作业二_升级版视觉漩涡.py b/第25讲冠军的即兴show/课堂成果/课后作业二_升级版视觉漩涡.py new file mode 100644 index 0000000..2ade00e --- /dev/null +++ b/第25讲冠军的即兴show/课堂成果/课后作业二_升级版视觉漩涡.py @@ -0,0 +1,29 @@ +''' + +课后作业二:升级版视觉漩涡 + +将上节课的作品视觉漩涡进行升级,添加渐变色,加快绘制速度''' +import turtle as t +import colorsys + +def side4(length): + for i in range(4): + t.forward(length) + t.left(90) + +t.tracer(10) +t.speed(0) +t.screensize(400,300,'black') # 初始化背景尺寸、颜色 +length = 5 # 初始化第一个正方形的边长为5 +h = 0 +for i in range(300): + c = colorsys.hsv_to_rgb(h,1,1) + t.pencolor(c) # 初始化画笔颜色 + h += 0.005 + if h > 1 : + h = 0 + side4(length) + t.left(3) + length += 1 + +t.done() diff --git a/第26讲狂欢夜大作战/26狂欢夜大作战讲义.pdf b/第26讲狂欢夜大作战/26狂欢夜大作战讲义.pdf new file mode 100644 index 0000000..5ad347c Binary files /dev/null and b/第26讲狂欢夜大作战/26狂欢夜大作战讲义.pdf differ diff --git a/第26讲狂欢夜大作战/狂欢夜大作战.png b/第26讲狂欢夜大作战/狂欢夜大作战.png new file mode 100644 index 0000000..2eb8cab Binary files /dev/null and b/第26讲狂欢夜大作战/狂欢夜大作战.png differ diff --git a/第26讲狂欢夜大作战/课堂成果/狂欢夜大作战.py b/第26讲狂欢夜大作战/课堂成果/狂欢夜大作战.py new file mode 100644 index 0000000..7f020c6 --- /dev/null +++ b/第26讲狂欢夜大作战/课堂成果/狂欢夜大作战.py @@ -0,0 +1,18 @@ +import random + +def choujiang(): + lucky_num = random.randint(1,20) # 随机生成幸运数字,1~20 + num = int(input('请从1到20之间选择一个数字进行抽奖:')) + if num == lucky_num: # 判断是否中奖 + print('天选幸运儿!恭喜你抽中大奖——狂欢夜当晚0元购!') + else: + print("幸运数字" + str(lucky_num)) + print('再接再厉!后面的题目还在等着你') + +right = int(input('共20题,你答对了多少道题?')) +if right > 5: + print('呱唧呱唧!获得抽奖机会!') + choujiang() # 开始抽奖 +else: + print('很遗憾,没有获得抽奖机会,再接再厉!') + diff --git a/第27讲同盟集结/27同盟集结讲义.pdf b/第27讲同盟集结/27同盟集结讲义.pdf new file mode 100644 index 0000000..4729cf2 Binary files /dev/null and b/第27讲同盟集结/27同盟集结讲义.pdf differ diff --git a/第27讲同盟集结/同盟集结.png b/第27讲同盟集结/同盟集结.png new file mode 100644 index 0000000..bfc6459 Binary files /dev/null and b/第27讲同盟集结/同盟集结.png differ diff --git a/第27讲同盟集结/课堂成果/同盟集结.py b/第27讲同盟集结/课堂成果/同盟集结.py new file mode 100644 index 0000000..d5802fc --- /dev/null +++ b/第27讲同盟集结/课堂成果/同盟集结.py @@ -0,0 +1,35 @@ +# 同盟集结 +import tkinter as tk # 导入tkinter库 + +# 检验答案,返回结果 +def check_answer(): + answer = var.get() + if answer == "HTML": + result_label.config(text="恭喜你获得考验资格,你敢接受挑战吗?") + else: + result_label.config(text="很遗憾,下次有缘再见") + +# 创建主窗口 +root = tk.Tk() # 创建主窗口对象,起名为root +root.title("同盟集结") # 配置窗口标题 +root.geometry('400x200+400+400') # 设置窗口大小 + +# 出题 +question_label = tk.Label(root, text="以下哪个选项不是编程语言?") +question_label.pack() +# 设置单选按钮 +var = tk.StringVar() +option_1 = tk.Radiobutton(root, text="Python", variable=var, value="Python") +option_2 = tk.Radiobutton(root, text="HTML", variable=var, value="HTML") +option_1.pack() +option_2.pack() + +# 创建提交按钮 +tijiao_button = tk.Button(root, text="提交答案", command=check_answer) +tijiao_button.pack() +# 创建结果标签 +result_label = tk.Label(root, text="") +result_label.pack() + +# 运行主循环,等待用户交互 +root.mainloop() diff --git a/第27讲同盟集结/课堂成果/课后作业-改四选项.py b/第27讲同盟集结/课堂成果/课后作业-改四选项.py new file mode 100644 index 0000000..895ef65 --- /dev/null +++ b/第27讲同盟集结/课堂成果/课后作业-改四选项.py @@ -0,0 +1,50 @@ +'''【课后作业要求】 +给题目再添加两个选项,如图: + +以下哪个选项不是编程语言? + +A.Python + +B.HTML + +C.Scratch + +D.C++ + +''' +import tkinter as tk # 导入tkinter库 + +def check_answer(): # 检验答案,返回结果 + answer = var.get() + if answer == "HTML": + result_label.config(text="恭喜你获得考验资格,你敢接受挑战吗?") + else: + result_label.config(text="很遗憾,下次有缘再见") + +# 创建主窗口 +root = tk.Tk() # 创建主窗口对象,起名为root +root.title("同盟集结") # 配置窗口标题 +root.geometry('400x200') # 设置窗口大小 + +# 出题 +question_label = tk.Label(root, text="以下哪个选项不是编程语言?") +question_label.pack() +# 设置单选按钮 +var = tk.StringVar() +option_1 = tk.Radiobutton(root, text="Python", variable=var, value="Python") +option_2 = tk.Radiobutton(root, text="HTML", variable=var, value="HTML") +option_3 = tk.Radiobutton(root, text="Scratch", variable=var, value="Scratch") +option_4 = tk.Radiobutton(root, text="C++", variable=var, value="C++") +option_1.pack() +option_2.pack() +option_3.pack() +option_4.pack() + +# 创建提交按钮和结果标签 +tijiao_button = tk.Button(root, text="提交答案", command=check_answer) # 提交按钮的创建 +tijiao_button.pack() +result_label = tk.Label(root, text="") # 结果标签的创建 +result_label.pack() + +# 运行主循环,等待用户交互 +root.mainloop() diff --git a/第28讲入会考验/28入会考验讲义.pdf b/第28讲入会考验/28入会考验讲义.pdf new file mode 100644 index 0000000..32b77fa Binary files /dev/null and b/第28讲入会考验/28入会考验讲义.pdf differ diff --git a/第28讲入会考验/入会考验.png b/第28讲入会考验/入会考验.png new file mode 100644 index 0000000..89a2ca2 Binary files /dev/null and b/第28讲入会考验/入会考验.png differ diff --git a/第28讲入会考验/课堂成果/简易时钟.py b/第28讲入会考验/课堂成果/简易时钟.py new file mode 100644 index 0000000..895ef65 --- /dev/null +++ b/第28讲入会考验/课堂成果/简易时钟.py @@ -0,0 +1,50 @@ +'''【课后作业要求】 +给题目再添加两个选项,如图: + +以下哪个选项不是编程语言? + +A.Python + +B.HTML + +C.Scratch + +D.C++ + +''' +import tkinter as tk # 导入tkinter库 + +def check_answer(): # 检验答案,返回结果 + answer = var.get() + if answer == "HTML": + result_label.config(text="恭喜你获得考验资格,你敢接受挑战吗?") + else: + result_label.config(text="很遗憾,下次有缘再见") + +# 创建主窗口 +root = tk.Tk() # 创建主窗口对象,起名为root +root.title("同盟集结") # 配置窗口标题 +root.geometry('400x200') # 设置窗口大小 + +# 出题 +question_label = tk.Label(root, text="以下哪个选项不是编程语言?") +question_label.pack() +# 设置单选按钮 +var = tk.StringVar() +option_1 = tk.Radiobutton(root, text="Python", variable=var, value="Python") +option_2 = tk.Radiobutton(root, text="HTML", variable=var, value="HTML") +option_3 = tk.Radiobutton(root, text="Scratch", variable=var, value="Scratch") +option_4 = tk.Radiobutton(root, text="C++", variable=var, value="C++") +option_1.pack() +option_2.pack() +option_3.pack() +option_4.pack() + +# 创建提交按钮和结果标签 +tijiao_button = tk.Button(root, text="提交答案", command=check_answer) # 提交按钮的创建 +tijiao_button.pack() +result_label = tk.Label(root, text="") # 结果标签的创建 +result_label.pack() + +# 运行主循环,等待用户交互 +root.mainloop() diff --git a/第28讲入会考验/课堂成果/课后作业1-调整作品.py b/第28讲入会考验/课堂成果/课后作业1-调整作品.py new file mode 100644 index 0000000..de27c14 --- /dev/null +++ b/第28讲入会考验/课堂成果/课后作业1-调整作品.py @@ -0,0 +1,38 @@ +'''【课后作业要求】 +挑战一: + +运用学到的知识对作品进行如下调整: + +1.设置窗口为宽度可调整,高度不可调整 + +2.设置标签字体为“宋体” + +3.设置标签背景色(黑、红、黄任选一) + +黑色“black”,bg="black" + +红色“red”,bg="red" + +黄色“yellow”,bg="yellow" + +''' +import tkinter as tk +import time + +root = tk.Tk() +root.title('大聪明的时钟') +root.geometry('400x80+400+400') +root.resizable(width=True,height=False) + +def update_clock(): + now = time.strftime('%H:%M:%S') + label.config(text=now) + root.after(1000,update_clock) + +label = tk.Label(text='',font=('宋体',60),fg='blue',bg='yellow') +label.pack() +update_clock() + +root.mainloop() + + diff --git a/第28讲入会考验/课堂成果/课后作业2-珍惜时间.py b/第28讲入会考验/课堂成果/课后作业2-珍惜时间.py new file mode 100644 index 0000000..8d080ad --- /dev/null +++ b/第28讲入会考验/课堂成果/课后作业2-珍惜时间.py @@ -0,0 +1,38 @@ +'''挑战二: + +运用学到的知识实现如图所示效果: + +提示: + +1. 创建名言标签并配置在窗口中 + +2. 设置合适的窗口尺寸(或者尝试使用默认参数)''' +# 导入tkinter、time库 +import tkinter as tk +import time + +# 创建主窗口 +root = tk.Tk() +root.title('大聪明的时钟') +root.geometry() +root.resizable(width=False,height=False) + +# 创建时间标签 +label = tk.Label(text='',font=('微软雅黑',60),fg='blue') +label.pack() +# 创建名言标签 +label_text = tk.Label(text='一寸光阴一寸金,寸金难买寸光阴',font=('微软雅黑',30),fg='black') +label_text.pack() + +# 定义更新时间的函数 +def update_clock(): + now = time.strftime('%H:%M:%S') + label.config(text=now) + root.after(1000,update_clock) # 每1秒(1000毫秒)调用一次update_clock函数 + +# 更新时间 +update_clock() + +# 运行主循环,等待用户交互 +root.mainloop() + diff --git a/第29讲身份二维码/29身份二维码讲义.pdf b/第29讲身份二维码/29身份二维码讲义.pdf new file mode 100644 index 0000000..176fc53 Binary files /dev/null and b/第29讲身份二维码/29身份二维码讲义.pdf differ diff --git a/第29讲身份二维码/课堂成果/budinggou.gif b/第29讲身份二维码/课堂成果/budinggou.gif new file mode 100644 index 0000000..56bafe6 Binary files /dev/null and b/第29讲身份二维码/课堂成果/budinggou.gif differ diff --git a/第29讲身份二维码/课堂成果/dahei.png b/第29讲身份二维码/课堂成果/dahei.png new file mode 100644 index 0000000..d4b7dbc Binary files /dev/null and b/第29讲身份二维码/课堂成果/dahei.png differ diff --git a/第29讲身份二维码/课堂成果/课后作业-别出心裁的信件.py b/第29讲身份二维码/课堂成果/课后作业-别出心裁的信件.py new file mode 100644 index 0000000..8ec85f0 --- /dev/null +++ b/第29讲身份二维码/课堂成果/课后作业-别出心裁的信件.py @@ -0,0 +1,25 @@ +''' +【课后作业要求】 +别出心裁的信件 + +P仔的小学弟博克斯,最近很烦恼。他跟同桌莱丝吵架了,不知道该怎么和好,请帮博克斯制作一封独特的二维码信件,向莱丝表达歉意。 + +小小建议: + +1. 可以跳转到道歉的图片或者逗莱丝开心的图片 + +2. 可以选用有纪念意义的照片作为背景图 + +3. 其他可选参数自行设置,无标准答案''' +from MyQR import myqr + +myqr.run( + words="Sorry!", # 跳转到的页面待定(必须是英文字符串) + version = 7, # 二维码版本 + level = 'Q', # 纠错等级,“H”表示最高等级 + picture = 'budinggou.gif', # 指定背景图片路径 + colorized = True, # 是否彩色二维码 + contrast = 1.2, # 对比度,根据需求调整 + brightness = 0.9, # 亮度,根据需求调整 + save_name = '作业.gif', + ) diff --git a/第29讲身份二维码/课堂成果/身份二维码.py b/第29讲身份二维码/课堂成果/身份二维码.py new file mode 100644 index 0000000..81a8400 --- /dev/null +++ b/第29讲身份二维码/课堂成果/身份二维码.py @@ -0,0 +1,12 @@ +from MyQR import myqr + +myqr.run( + words="Hello, World!", # 跳转到的页面待定(必须是英文字符串) + version = 5, # 二维码版本 + level = 'H', # 纠错等级,“H”表示最高等级 + picture = 'budinggou.gif', # 指定背景图片路径 + colorized = True, # 是否彩色二维码 + contrast = 1.0, # 对比度,根据需求调整 + brightness = 1.0, # 亮度,根据需求调整 + save_name = '身份二维码_小米.gif', + ) diff --git a/第29讲身份二维码/身份二维码.png b/第29讲身份二维码/身份二维码.png new file mode 100644 index 0000000..205afb9 Binary files /dev/null and b/第29讲身份二维码/身份二维码.png differ diff --git a/第2讲神奇画笔在哪里/02神奇画笔在哪里讲义.pdf b/第2讲神奇画笔在哪里/02神奇画笔在哪里讲义.pdf new file mode 100644 index 0000000..9b0a4fa Binary files /dev/null and b/第2讲神奇画笔在哪里/02神奇画笔在哪里讲义.pdf differ diff --git a/第2讲神奇画笔在哪里/神奇画笔在哪里.png b/第2讲神奇画笔在哪里/神奇画笔在哪里.png new file mode 100644 index 0000000..19b81cb Binary files /dev/null and b/第2讲神奇画笔在哪里/神奇画笔在哪里.png differ diff --git a/第2讲神奇画笔在哪里/课堂成果/画三角形.py b/第2讲神奇画笔在哪里/课堂成果/画三角形.py new file mode 100644 index 0000000..90d9648 --- /dev/null +++ b/第2讲神奇画笔在哪里/课堂成果/画三角形.py @@ -0,0 +1,16 @@ +#导入turtle模块,起别名t +import turtle as t + +#画第一条边 +t.forward(100) #画边长为100的线段 +t.left(120) #原地左转120度 + +#画第二条边 +t.forward(100) #画边长为100的线段 +t.left(120) #原地左转120度 + +#画第三条边 +t.forward(100) #画边长为100的线段 +t.left(120) #原地左转120度 + +t.done() \ No newline at end of file diff --git a/第2讲神奇画笔在哪里/课堂成果/画正方形.py b/第2讲神奇画笔在哪里/课堂成果/画正方形.py new file mode 100644 index 0000000..9e2be44 --- /dev/null +++ b/第2讲神奇画笔在哪里/课堂成果/画正方形.py @@ -0,0 +1,12 @@ +import turtle as t + +t.forward(100) # 画第一条边 +t.right(90) # 右转90° +t.forward(100) # 画第二条边 +t.right(90) # 右转90° +t.forward(100) # 画第三条边 +t.right(90) # 右转90° +t.forward(100) # 画第四条边 +t.right(90) # 右转90° + +t.done() # 停止画笔绘制,但绘图窗体不关闭 \ No newline at end of file diff --git a/第2讲神奇画笔在哪里/课堂成果/胜利的五角星.py b/第2讲神奇画笔在哪里/课堂成果/胜利的五角星.py new file mode 100644 index 0000000..f6f7944 --- /dev/null +++ b/第2讲神奇画笔在哪里/课堂成果/胜利的五角星.py @@ -0,0 +1,13 @@ +import turtle as t #导入turtle模块,起别名t + +t.forward(100) #画边长为100的线段 +t.right(144) #原地右转144度 +t.forward(100) #画边长为100的线段 +t.right(144) #原地右转144度 +t.forward(100) #画边长为100的线段 +t.right(144) #原地右转144度 +t.forward(100) #画边长为100的线段 +t.right(144) #原地右转144度 +t.forward(100) #画边长为100的线段 +t.right(144) #原地右转144度 +t.done() #停止画笔绘制,但绘图窗体不关闭 \ No newline at end of file diff --git a/第2讲神奇画笔在哪里/课堂成果/课后作业_圈圈圆圆圈圈.py b/第2讲神奇画笔在哪里/课堂成果/课后作业_圈圈圆圆圈圈.py new file mode 100644 index 0000000..ce94b99 --- /dev/null +++ b/第2讲神奇画笔在哪里/课堂成果/课后作业_圈圈圆圆圈圈.py @@ -0,0 +1,5 @@ +import turtle as t +t.circle(50) +t.circle(80) +t.circle(100) +t.done() \ No newline at end of file diff --git a/第30讲谁的恶作剧/30谁的恶作剧讲义.pdf b/第30讲谁的恶作剧/30谁的恶作剧讲义.pdf new file mode 100644 index 0000000..6f492a7 Binary files /dev/null and b/第30讲谁的恶作剧/30谁的恶作剧讲义.pdf differ diff --git a/第30讲谁的恶作剧/课堂成果/课后作业-弹窗木马.py b/第30讲谁的恶作剧/课堂成果/课后作业-弹窗木马.py new file mode 100644 index 0000000..c68a71e --- /dev/null +++ b/第30讲谁的恶作剧/课堂成果/课后作业-弹窗木马.py @@ -0,0 +1,39 @@ +'''【课后作业要求】 +弹窗木马 + +模拟本节课作品,完成视频中的轰炸效果。标签文字、颜色可以自定义。 + +提示: + +想要设置标签文字颜色, + +可以使用 fg=''''' +import tkinter as tk # 导入tkinter库 +import random # 导入随机库 +import threading # 导入threading库,用于创建和管理线程 +import time # 导入时间库 + +def tanchuang(): + root = tk.Tk() # 创建窗口对象 + width = root.winfo_screenwidth() # 获取屏幕的宽度 + height = root.winfo_screenheight() # 获取屏幕的高度 + x = random.randint(0, width) # 随机生成的宽度 + y = random.randint(0, height) # 随机生成的高度 + root.title('恶作剧') # 定义窗口的标题 + root.geometry(f"400x100+{x}+{y}") # 设置窗口的尺寸、位置 + tk.Label(root, + text='Error!', # 显示文字 + bg='black', # 背景颜色 + fg='red', # 标签字体颜色 + font=('楷体', 25), # 字体和字体大小 + width=40, height=4 # 标签长宽 + ).pack() # 配置标签位置 + root.mainloop() + +for i in range(100): # 需要的弹框数量,根据自己需要来修改 + # 创建一个线程对象,将tanchuang函数作为目标函数 + t = threading.Thread(target=tanchuang) + # 使主线程暂停0.1秒,以延迟新线程的启动。确保窗口不是同时出现,有一定间隔 + time.sleep(0.1) + # 启动线程,调用dow函数并创建一个新弹出窗口 + t.start() diff --git a/第30讲谁的恶作剧/课堂成果/谁的恶作剧.py b/第30讲谁的恶作剧/课堂成果/谁的恶作剧.py new file mode 100644 index 0000000..8ec85f0 --- /dev/null +++ b/第30讲谁的恶作剧/课堂成果/谁的恶作剧.py @@ -0,0 +1,25 @@ +''' +【课后作业要求】 +别出心裁的信件 + +P仔的小学弟博克斯,最近很烦恼。他跟同桌莱丝吵架了,不知道该怎么和好,请帮博克斯制作一封独特的二维码信件,向莱丝表达歉意。 + +小小建议: + +1. 可以跳转到道歉的图片或者逗莱丝开心的图片 + +2. 可以选用有纪念意义的照片作为背景图 + +3. 其他可选参数自行设置,无标准答案''' +from MyQR import myqr + +myqr.run( + words="Sorry!", # 跳转到的页面待定(必须是英文字符串) + version = 7, # 二维码版本 + level = 'Q', # 纠错等级,“H”表示最高等级 + picture = 'budinggou.gif', # 指定背景图片路径 + colorized = True, # 是否彩色二维码 + contrast = 1.2, # 对比度,根据需求调整 + brightness = 0.9, # 亮度,根据需求调整 + save_name = '作业.gif', + ) diff --git a/第30讲谁的恶作剧/谁的恶作剧.png b/第30讲谁的恶作剧/谁的恶作剧.png new file mode 100644 index 0000000..eb061f2 Binary files /dev/null and b/第30讲谁的恶作剧/谁的恶作剧.png differ diff --git a/第31讲捣蛋鬼的忏悔/31捣蛋鬼的忏悔讲义.pdf b/第31讲捣蛋鬼的忏悔/31捣蛋鬼的忏悔讲义.pdf new file mode 100644 index 0000000..2c5d9cd Binary files /dev/null and b/第31讲捣蛋鬼的忏悔/31捣蛋鬼的忏悔讲义.pdf differ diff --git a/第31讲捣蛋鬼的忏悔/捣蛋鬼的忏悔.png b/第31讲捣蛋鬼的忏悔/捣蛋鬼的忏悔.png new file mode 100644 index 0000000..7c9d5b6 Binary files /dev/null and b/第31讲捣蛋鬼的忏悔/捣蛋鬼的忏悔.png differ diff --git a/第31讲捣蛋鬼的忏悔/课堂成果/捣蛋鬼的忏悔.py b/第31讲捣蛋鬼的忏悔/课堂成果/捣蛋鬼的忏悔.py new file mode 100644 index 0000000..340057b --- /dev/null +++ b/第31讲捣蛋鬼的忏悔/课堂成果/捣蛋鬼的忏悔.py @@ -0,0 +1,25 @@ +import tkinter as tk +import random + +def move_window(): # 移动窗口随机出现 + x = random.randint(0, root.winfo_screenwidth() - 400) + y = random.randint(0, root.winfo_screenheight() - 100) + root.geometry("400x100"+"+"+str(x)+"+"+str(y)) +def yes(): # 对方谅解 + label.config(text="谢谢您的谅解!") + root.after(1000, root.destroy) # 感谢谅解1秒后关闭窗口 + +root = tk.Tk() # 创建窗口对象 +root.title("小米的忏悔") # 定义窗口的标题 +root.geometry("400x100") # 设置窗口的尺寸 + +label = tk.Label(root, text="最近给大家添麻烦了,对不起!你们能够原谅我吗?") +label.pack() # 配置标签 +button_no = tk.Button(root, text="不原谅", bg = 'red', fg = 'white', command=move_window) +button_no.pack() # 配置“不原谅”按钮 +button_yes = tk.Button(root, text="原谅你吧!", bg = "green", fg = 'white', command=yes) +button_yes.pack() # 配置“原谅”按钮 +label = tk.Label(root, text="") +label.pack() # 配置“感谢谅解”的标签 + +root.mainloop() diff --git a/第32讲自动组卷系统(一)/32自动组卷系统一讲义.pdf b/第32讲自动组卷系统(一)/32自动组卷系统一讲义.pdf new file mode 100644 index 0000000..83b34bb Binary files /dev/null and b/第32讲自动组卷系统(一)/32自动组卷系统一讲义.pdf differ diff --git a/第32讲自动组卷系统(一)/自动组卷系统(一).png b/第32讲自动组卷系统(一)/自动组卷系统(一).png new file mode 100644 index 0000000..40ee643 Binary files /dev/null and b/第32讲自动组卷系统(一)/自动组卷系统(一).png differ diff --git a/第32讲自动组卷系统(一)/课堂成果/自动组卷系统.py b/第32讲自动组卷系统(一)/课堂成果/自动组卷系统.py new file mode 100644 index 0000000..c7ae325 --- /dev/null +++ b/第32讲自动组卷系统(一)/课堂成果/自动组卷系统.py @@ -0,0 +1,23 @@ +# 匹配的国家和地标 +landmarks = {"中国": "长城", "古埃及": "金字塔", "法国": "埃菲尔铁塔", + "印度": "泰姬陵", "英国": "大本钟", "美国": "自由女神像", + "意大利": "比萨斜塔", "澳大利亚": "悉尼歌剧院", "希腊": "帕特农神庙", + "日本": "富士山", "南非": "好望角", "丹麦": "小美人鱼铜像", + "巴西": "基督像", "泰国": "大皇宫", "加拿大": "CN塔", + "荷兰": "桑斯安斯风车村", "俄罗斯": "红场", "捷克": "布拉格城堡", + "沙特阿拉伯": "麦加大清真寺", "西班牙": "圣家族大教堂" + } + +# 生成10套测验 +for i in range(10): + # 新建带编号的测试卷和答案文件    + testNum = i + 1 + testFile = open('小小旅行家%s.txt'%(testNum), 'w') + answerFile = open('小小旅行家_答案%s.txt'%(testNum), 'w') + # 写测试卷的抬头 + testFile.write('姓名:\n\n班级:\n\n日期:\n\n') + testFile.write((' ' * 20) + '小小旅行家地标挑战赛 (Form %s)' % (testNum)) + testFile.write('\n\n') + # <待做:打乱国家的顺序> + # <待做:生成10道题目和答案> + diff --git a/第32讲自动组卷系统(一)/课堂成果/课后作业-小明最喜欢的动漫.py b/第32讲自动组卷系统(一)/课堂成果/课后作业-小明最喜欢的动漫.py new file mode 100644 index 0000000..f9f8684 --- /dev/null +++ b/第32讲自动组卷系统(一)/课堂成果/课后作业-小明最喜欢的动漫.py @@ -0,0 +1,11 @@ +'''写一个小程序,帮助小明记录他最喜欢的动漫和对它们的描述。程序会先询问小明最喜欢的动漫数量,然后依次让小明输入每个动漫的名称和描述。最后,程序会将记录保存到一个文件中。文件示意如下。''' +my_file = open('小明最喜欢的动漫', 'w') +my_file.write(' '*20 + '小明最喜欢的动漫\n') +num = int(input('小明最喜欢的动漫数量:')) +for i in range(num): + name = input('动漫名称:') + story = input('动漫描述:') + my_file.write(f'{name}:{story}') + my_file.write('\n') +my_file.close() + diff --git a/第33讲自动组卷系统(二)/33自动组卷系统二讲义.pdf b/第33讲自动组卷系统(二)/33自动组卷系统二讲义.pdf new file mode 100644 index 0000000..95558aa Binary files /dev/null and b/第33讲自动组卷系统(二)/33自动组卷系统二讲义.pdf differ diff --git a/第33讲自动组卷系统(二)/自动组卷系统(二).png b/第33讲自动组卷系统(二)/自动组卷系统(二).png new file mode 100644 index 0000000..0d576e4 Binary files /dev/null and b/第33讲自动组卷系统(二)/自动组卷系统(二).png differ diff --git a/第33讲自动组卷系统(二)/课堂成果/自动组卷系统二.py b/第33讲自动组卷系统(二)/课堂成果/自动组卷系统二.py new file mode 100644 index 0000000..8e8ee6b --- /dev/null +++ b/第33讲自动组卷系统(二)/课堂成果/自动组卷系统二.py @@ -0,0 +1,49 @@ +import random +# 匹配的国家和地标 +landmarks = {"中国": "长城", "古埃及": "金字塔", "法国": "埃菲尔铁塔", + "印度": "泰姬陵", "英国": "大本钟", "美国": "自由女神像", + "意大利": "比萨斜塔", "澳大利亚": "悉尼歌剧院", "希腊": "帕特农神庙", + "日本": "富士山", "南非": "好望角", "丹麦": "小美人鱼铜像", + "巴西": "基督像", "泰国": "大皇宫", "加拿大": "CN塔", + "荷兰": "桑斯安斯风车村", "俄罗斯": "红场", "捷克": "布拉格城堡", + "沙特阿拉伯": "麦加大清真寺", "西班牙": "圣家族大教堂" + } + +# 生成10套测验 +for i in range(10): + # 新建带编号的测试卷和答案文件    + testNum = i + 1 + testFile = open('小小旅行家%s.txt'%(testNum), 'w') + answerFile = open('小小旅行家_答案%s.txt'%(testNum), 'w') + # 写测试卷的抬头 + testFile.write('姓名:\n\n班级:\n\n日期:\n\n') + testFile.write((' ' * 20) + '小小旅行家地标挑战赛 (Form %s)' % (testNum)) + testFile.write('\n\n') + # 打乱顺序 + states = list(landmarks.keys()) + random.shuffle(states) + # 生成10道题目和答案 + for j in range(10): + # 设置问题并写入 + questionNum = j + 1 + state = states[j] + testFile.write(f'{questionNum}. {state} 的地标建筑是?\n') + # 获取选项 + correctAnswer = landmarks[state] + wrongAnswers = list(landmarks.values()) + wrongAnswers.remove(correctAnswer) + wrongAnswers = random.sample(wrongAnswers, 3) + answerOptions = wrongAnswers + [correctAnswer] + # 打乱【答案选项】 + random.shuffle(answerOptions) + # 将选项写入测验文件 + for k in range(4): + testFile.write(f' {"ABCD"[k]}. {answerOptions[k]}\n') + testFile.write('\n') + # 将答案写入答案文件 + correctOption = 'ABCD'[answerOptions.index(correctAnswer)] + answerFile.write(f'{questionNum}. {correctOption}\n') + # 关闭测验文件、答案文件 + testFile.close() + answerFile.close() + diff --git a/第33讲自动组卷系统(二)/课堂成果/课后作业-来拆盲盒吧.py b/第33讲自动组卷系统(二)/课堂成果/课后作业-来拆盲盒吧.py new file mode 100644 index 0000000..0fbfba9 --- /dev/null +++ b/第33讲自动组卷系统(二)/课堂成果/课后作业-来拆盲盒吧.py @@ -0,0 +1,41 @@ +'''来拆盲盒吧 + +超市最近新推出了商品盲盒的活动,顾客支付30元可以获得一次开盲盒的机会。顾客们都跃跃欲试,想看看自己的手气。 + +盲盒中会随机出现三种商品,你可能会买到价值远高于30的商品,你也可能得到刚好30或者低于30的商品。快来试试自己的运气吧! + +提示如下: + +1. 已知参与盲盒活动的商品及价格 + +2. 从中随机抽取三种商品并输出 + +3. 计算抽出的三种商品总价值 + +4. 输出“你的盲盒价值××元”''' +import random +shop = { + '防滑衣架1套':10, '湿巾1包':4, '中性笔1支':3, '牙膏1管':33, + '矿泉水1瓶':2, '洗洁精1瓶':7 , '苹果3斤':15, '蔓越莓曲奇1盒':7, + '泡椒凤爪1包':5, '鱿鱼丝1包':22 + } + +# 方法一: +goods = list(shop.keys()) +my = random.sample(goods, 3) +print(my) +total= int(shop[my[0]]) + int(shop[my[1]]) + int(shop[my[2]]) +print(f'您的盲盒价值{total}元') + + +''' +# 方法二: +goods = list(shop.keys()) +random.shuffle(goods) +my = [] +for i in range(3): + my.append(goods[i]) +print(my) +total= int(shop[my[0]]) + int(shop[my[1]]) + int(shop[my[2]]) +print(f'您的盲盒价值{total}元') +''' diff --git a/第34讲自动排名系统(一)/34自动排名系统一讲义.pdf b/第34讲自动排名系统(一)/34自动排名系统一讲义.pdf new file mode 100644 index 0000000..01ba3aa Binary files /dev/null and b/第34讲自动排名系统(一)/34自动排名系统一讲义.pdf differ diff --git a/第34讲自动排名系统(一)/自动排名系统(一).png b/第34讲自动排名系统(一)/自动排名系统(一).png new file mode 100644 index 0000000..b635892 Binary files /dev/null and b/第34讲自动排名系统(一)/自动排名系统(一).png differ diff --git a/第34讲自动排名系统(一)/课堂成果/《自动排名系统》-windows用.7z b/第34讲自动排名系统(一)/课堂成果/《自动排名系统》-windows用.7z new file mode 100644 index 0000000..7846b56 Binary files /dev/null and b/第34讲自动排名系统(一)/课堂成果/《自动排名系统》-windows用.7z differ diff --git a/第34讲自动排名系统(一)/课堂成果/自动排名系统.py b/第34讲自动排名系统(一)/课堂成果/自动排名系统.py new file mode 100644 index 0000000..55a315b --- /dev/null +++ b/第34讲自动排名系统(一)/课堂成果/自动排名系统.py @@ -0,0 +1,20 @@ +# 运行程序前, 请务必前往本课包【课程说明】处,下载课程素材,完成配置 + +import csv +# 读取CSV文件并计算平均分进行排序 +def process(filename): + with open(filename, 'r') as csvfile: + reader = csv.DictReader(csvfile) + for row in reader: + # 提取学生姓名和成绩,并转换成整数 + name = row['姓名'] + landmark_score = int(row['地标挑战赛成绩']) + history_score = int(row['历史挑战赛成绩']) + life_score = int(row['生活常识挑战赛成绩']) + + # 计算总分 + total_score = landmark_score + history_score + life_score + print(total_score) # print语句仅测试使用,后面可以删掉 + +process('scores.csv') + diff --git a/第34讲自动排名系统(一)/课堂成果/课后作业-谁跑的最快.py b/第34讲自动排名系统(一)/课堂成果/课后作业-谁跑的最快.py new file mode 100644 index 0000000..35f04fc --- /dev/null +++ b/第34讲自动排名系统(一)/课堂成果/课后作业-谁跑的最快.py @@ -0,0 +1,17 @@ +'''谁跑得最快 + +学校举办了一场小型运动会,记录了学生们的百米赛跑成绩。这些成绩保存在"跑步成绩.csv"文件中,你需要编写一个简单的程序来打印出学生的跑步成绩,格式如下: + +××的成绩是××秒''' +# 运行程序前, 请务必前往本课包【课程说明】处,下载课程素材,完成配置 + +import csv +def who(filename): + with open(filename, 'r') as csvfile: + reader = csv.DictReader(csvfile) + for row in reader: + name = row['姓名'] + score = row['成绩'] + print(f'{name}的成绩是{score}秒') + +who('跑步成绩.csv') diff --git a/第35讲自动排名系统(二)/35自动排名系统二讲义.pdf b/第35讲自动排名系统(二)/35自动排名系统二讲义.pdf new file mode 100644 index 0000000..780a287 Binary files /dev/null and b/第35讲自动排名系统(二)/35自动排名系统二讲义.pdf differ diff --git a/第35讲自动排名系统(二)/自动排名系统(二).png b/第35讲自动排名系统(二)/自动排名系统(二).png new file mode 100644 index 0000000..e1f66cb Binary files /dev/null and b/第35讲自动排名系统(二)/自动排名系统(二).png differ diff --git a/第35讲自动排名系统(二)/课堂成果/《自动排名系统》-windows用.7z b/第35讲自动排名系统(二)/课堂成果/《自动排名系统》-windows用.7z new file mode 100644 index 0000000..7846b56 Binary files /dev/null and b/第35讲自动排名系统(二)/课堂成果/《自动排名系统》-windows用.7z differ diff --git a/第35讲自动排名系统(二)/课堂成果/自动排名系统二-全程序.py b/第35讲自动排名系统(二)/课堂成果/自动排名系统二-全程序.py new file mode 100644 index 0000000..5d56d85 --- /dev/null +++ b/第35讲自动排名系统(二)/课堂成果/自动排名系统二-全程序.py @@ -0,0 +1,47 @@ +# 运行程序前, 请务必前往本课包【课程说明】处,下载课程素材,完成配置 + +import csv + +# 获取各字典中的总分 +def ave(s): # s是列表中的每一项 + return s['总分'] + +# 读取CSV文件并计算总分进行排序 +def process(filename): + students = [] + with open(filename, 'r') as csvfile: + reader = csv.DictReader(csvfile) + for row in reader: + # 提取学生姓名和成绩,并转换成整数 + name = row['姓名'] + landmark_score = int(row['地标挑战赛成绩']) + history_score = int(row['历史挑战赛成绩']) + life_score = int(row['生活常识挑战赛成绩']) + + # 计算总分 + total_score = landmark_score + history_score + life_score + + # 创建一个字典存储学生信息和总分 + stu_info = { + '姓名': name, + '总分': total_score + } + + # 将字典添加到列表中 + students.append(stu_info) + + # 根据总分对学生进行排序(降序) + students.sort(key=ave, reverse=True) + + return students + +# 打印排名结果 +def print_rank(students): + print("排名\t姓名\t总分") + for i, student in enumerate(students, start=1): + print(f"{i}\t{student['姓名']}\t{student['总分']}") + +# 主程序 +students = process('scores.csv') # 指定CSV文件 +print_rank(students) +print(f"代表班级参加知识竞赛的是:{students[0]['姓名']}") diff --git a/第35讲自动排名系统(二)/课堂成果/课后作业-魔法学习的成绩排名.py b/第35讲自动排名系统(二)/课堂成果/课后作业-魔法学习的成绩排名.py new file mode 100644 index 0000000..92e8635 --- /dev/null +++ b/第35讲自动排名系统(二)/课堂成果/课后作业-魔法学习的成绩排名.py @@ -0,0 +1,22 @@ +'''【课后作业要求】 +魔法学校的考试排名 + +在一所魔法学校,学生们刚刚完成了一场重要的魔法考试。每位学生都获得了不同的分数,现在需要根据分数对学生进行排名,并颁发奖励给分数最高的三位学生。 + +任务要求: + +1. 已知包含学生姓名和对应分数的列表为: + +students = [ {'姓名': '赫敏', '分数': 92}, {'姓名': '哈利', '分数': 95}, {'姓名': '罗恩', '分数': 88}] + +2. 使用列表排序功能,根据分数对所有学生进行降序排序 + +3. 使用枚举函数打印出排名前三的学生,结构为“第×名:××”''' +# 运行程序前, 请务必前往本课包【课程说明】处,下载课程素材,完成配置 + +students = [{'姓名': '赫敏', '分数': 92}, + {'姓名': '哈利', '分数': 95}, + {'姓名': '罗恩', '分数': 88}] +students.sort(key = lambda s:s['分数'], reverse = True) +for i,name in enumerate(students, start=1): + print(f"第{i}名:{name['姓名']}") diff --git a/第36讲知识达人/36知识达人讲义.pdf b/第36讲知识达人/36知识达人讲义.pdf new file mode 100644 index 0000000..15e4253 Binary files /dev/null and b/第36讲知识达人/36知识达人讲义.pdf differ diff --git a/第36讲知识达人/知识达人.png b/第36讲知识达人/知识达人.png new file mode 100644 index 0000000..c98db96 Binary files /dev/null and b/第36讲知识达人/知识达人.png differ diff --git a/第36讲知识达人/课堂成果/《知识达人》.7z b/第36讲知识达人/课堂成果/《知识达人》.7z new file mode 100644 index 0000000..a39891b Binary files /dev/null and b/第36讲知识达人/课堂成果/《知识达人》.7z differ diff --git a/第36讲知识达人/课堂成果/知识达人.py b/第36讲知识达人/课堂成果/知识达人.py new file mode 100644 index 0000000..c67de83 --- /dev/null +++ b/第36讲知识达人/课堂成果/知识达人.py @@ -0,0 +1,25 @@ +# 运行程序前, 请务必前往本课包【课程说明】处,下载课程素材,完成配置 + +# 参考答案一 +with open('知识达人题目.txt','r', encoding="utf-8") as my_file: + p = my_file.readlines() + for line in p: + print(line) + +with open('答案.txt','w', encoding="utf-8") as my_file: + for i in range(1,11): + answer = input(f'第{i}题的答案是:') + my_file.write(f'{answer}\n') + +''' +# 参考答案二 +with open('知识达人题目.txt','r', encoding="utf-8") as my_file: + for line in my_file: + print(line) + +with open('答案.txt','w', encoding="utf-8") as my_file: + for i in range(1,11): + answer = input(f'第{i}题的答案是:') + my_file.write(f'{answer}\n') +''' + diff --git a/第37讲警报异常来袭/37警报异常来袭讲义.pdf b/第37讲警报异常来袭/37警报异常来袭讲义.pdf new file mode 100644 index 0000000..ff339d4 Binary files /dev/null and b/第37讲警报异常来袭/37警报异常来袭讲义.pdf differ diff --git a/第37讲警报异常来袭/警报!异常来袭.png b/第37讲警报异常来袭/警报!异常来袭.png new file mode 100644 index 0000000..f90253a Binary files /dev/null and b/第37讲警报异常来袭/警报!异常来袭.png differ diff --git a/第37讲警报异常来袭/课堂成果/课后作业-异常处理.py b/第37讲警报异常来袭/课堂成果/课后作业-异常处理.py new file mode 100644 index 0000000..9930151 --- /dev/null +++ b/第37讲警报异常来袭/课堂成果/课后作业-异常处理.py @@ -0,0 +1,20 @@ +'''【课后作业要求】 +编写一个 Python 程序,要求实现以下功能: + +1. 提示用户输入一个数字作为除数(被除数固定为65),并尝试计算65除以除数的结果并输出 + +2. 如果用户输入的是非数字(如字母、特殊字符等),则捕获异常并提示“输入的内容有误,请输入一个数字” + +3. 如果用户输入的是数字但为 0(即除数为 0),也捕获异常并提示用户“不能输入0作为除数” + +4. 如果有其他的异常,则捕获并输出异常信息''' +try: + num = int(input("请输入一个数字作为除数:")) + result = 65 / num # 计算除法结果 + print(f"计算结果为: {result}") +except ValueError: + print("输入的内容有误,请输入一个数字") +except ZeroDivisionError: + print("不能输入0作为除数") +except Exception as e: + print(e) diff --git a/第38讲 全员debug/38全员debug讲义.pdf b/第38讲 全员debug/38全员debug讲义.pdf new file mode 100644 index 0000000..31e825f Binary files /dev/null and b/第38讲 全员debug/38全员debug讲义.pdf differ diff --git a/第38讲 全员debug/全员debug.png b/第38讲 全员debug/全员debug.png new file mode 100644 index 0000000..3b28cfd Binary files /dev/null and b/第38讲 全员debug/全员debug.png differ diff --git a/第38讲 全员debug/课堂成果/全员debug-正确源码.py b/第38讲 全员debug/课堂成果/全员debug-正确源码.py new file mode 100644 index 0000000..6058bc0 --- /dev/null +++ b/第38讲 全员debug/课堂成果/全员debug-正确源码.py @@ -0,0 +1,39 @@ +# 定义一个函数,进行累加操作 +def sum_list(lst): + sum = 0 + for num in lst: + sum += num + return sum + +# 定义一个函数,找出列表中的最大值 +def max_list(lst): + return max(lst) + +# 定义一个函数,把输入的字符串转换为整数列表 +def str_to_list(s): + s1 = [] + for i in s.split(): + s1.append(int(i)) + return s1 + +# 代码主体部分 +while True: + print("1: 求和") + print("2: 求最大值") + print("3: 退出") + choice = int(input("请输入操作编号:")) + + # 根据用户的选择执行不同任务 + if choice == 1: + s = input("请输入一串以空格分隔的数字:") + lst = str_to_list(s) + print("和为", sum_list(lst)) + elif choice == 2: + s = input("请输入一串以空格分隔的数字:") + lst = str_to_list(s) + print("最大值为", max_list(lst)) + elif choice == 3: + break + else: + print("输入无效") + diff --git a/第38讲 全员debug/课堂成果/课后作业-找出感叹号.py b/第38讲 全员debug/课堂成果/课后作业-找出感叹号.py new file mode 100644 index 0000000..7641af8 --- /dev/null +++ b/第38讲 全员debug/课堂成果/课后作业-找出感叹号.py @@ -0,0 +1,24 @@ +'''【课后作业要求】 +请找出下列代码中的3处错误,并改正: + +def check(s): + + if "!" in s + + print("字符串中含有感叹号!") + + else: + + print("字符串中没有感叹号!") + +string = "Hello world" + +check(s) ''' +def check(s): + if "!" in s: + print("字符串中含有感叹号!") + else: + print("字符串中没有感叹号!") +string = "Hello world" +check(string) + diff --git a/第39讲 特工年度大考/39特工年度大考讲义.pdf b/第39讲 特工年度大考/39特工年度大考讲义.pdf new file mode 100644 index 0000000..e8066cf Binary files /dev/null and b/第39讲 特工年度大考/39特工年度大考讲义.pdf differ diff --git a/第39讲 特工年度大考/特工年度大考.png b/第39讲 特工年度大考/特工年度大考.png new file mode 100644 index 0000000..af90208 Binary files /dev/null and b/第39讲 特工年度大考/特工年度大考.png differ diff --git a/第39讲 特工年度大考/课堂成果/特工大考-数学.py b/第39讲 特工年度大考/课堂成果/特工大考-数学.py new file mode 100644 index 0000000..92d5d03 --- /dev/null +++ b/第39讲 特工年度大考/课堂成果/特工大考-数学.py @@ -0,0 +1,21 @@ +# 判断输入的数字是否为自幂数 + +# 判断数字是否是自幂数 +def check(num): + # 将数字转换为字符串以方便处理每一位数字 + num_str = str(num) + # 获取数字的位数 + n = len(num_str) + + # 计算每位数字的n次幂之和 + num_sum = 0 + for i in num_str: + num_sum += int(i) ** n + + # 判断是否等于原数字 + return num_sum == num + + +# 测试函数 +n = int(input("请输入要确认的数字:")) +print(check(n)) diff --git a/第39讲 特工年度大考/课堂成果/特工大考-英语.py b/第39讲 特工年度大考/课堂成果/特工大考-英语.py new file mode 100644 index 0000000..62d63f2 --- /dev/null +++ b/第39讲 特工年度大考/课堂成果/特工大考-英语.py @@ -0,0 +1,11 @@ +# 单词出现频次统计 + +string = "to be or not to be that is a question" # 定义变量存储字符串 +lis = string.split(" ") # 使用分割函数将字符串转为列表 +count = {} # 定义一个空字典 +for x in lis: # 遍历列表 + if x not in count: # 判断列表元素是否在字典中 + count[x] = 1 # 如果元素还不在字典中,那么就添加键值对 + else: + count[x] += 1 # 如果元素已经在字典中,那么就将键对应的值加1 +print(count) # 打印字典 diff --git a/第39讲 特工年度大考/课堂成果/特工大考-语文.py b/第39讲 特工年度大考/课堂成果/特工大考-语文.py new file mode 100644 index 0000000..5286681 --- /dev/null +++ b/第39讲 特工年度大考/课堂成果/特工大考-语文.py @@ -0,0 +1,27 @@ +# 诗仙本仙:生成诗词考题 + +import random + +# 诗句列表 +poems = [ + "白日依山尽,黄河入海流。", + "采菊东篱下,悠然见南山。", + "山重水复疑无路,柳暗花明又一村。", + "天生我材必有用,千金散尽还复来。", + # 可以继续添加更多诗句 +] + +# 随机选择一个诗句 +poem = random.choice(poems) + +# 将诗句按逗号分割成前后两部分 +part = poem.split(',') + +# 随机决定是替换前半句还是后半句 +if random.choice([True, False]): + question = "__________," + part[1] # 替换前半句 +else: + question = part[0] + ",__________" # 替换后半句 + +# 生成题目并打印出来 +print(question) \ No newline at end of file diff --git a/第3讲转啊转啊转/03转啊转啊转讲义.pdf b/第3讲转啊转啊转/03转啊转啊转讲义.pdf new file mode 100644 index 0000000..39d642f Binary files /dev/null and b/第3讲转啊转啊转/03转啊转啊转讲义.pdf differ diff --git a/第3讲转啊转啊转/课堂成果/好好学习天天向上.py b/第3讲转啊转啊转/课堂成果/好好学习天天向上.py new file mode 100644 index 0000000..ab8406d --- /dev/null +++ b/第3讲转啊转啊转/课堂成果/好好学习天天向上.py @@ -0,0 +1,8 @@ +# 导入turtle模块,起别名t +import turtle as t + +for i in range(3): + t.forward(100) # 画边长 + t.left(120) # 左转120度 + +t.done() \ No newline at end of file diff --git a/第3讲转啊转啊转/课堂成果/画三角形(简化后).py b/第3讲转啊转啊转/课堂成果/画三角形(简化后).py new file mode 100644 index 0000000..ab8406d --- /dev/null +++ b/第3讲转啊转啊转/课堂成果/画三角形(简化后).py @@ -0,0 +1,8 @@ +# 导入turtle模块,起别名t +import turtle as t + +for i in range(3): + t.forward(100) # 画边长 + t.left(120) # 左转120度 + +t.done() \ No newline at end of file diff --git a/第3讲转啊转啊转/课堂成果/画五角星(简化后 ).py b/第3讲转啊转啊转/课堂成果/画五角星(简化后 ).py new file mode 100644 index 0000000..d6d46a1 --- /dev/null +++ b/第3讲转啊转啊转/课堂成果/画五角星(简化后 ).py @@ -0,0 +1,11 @@ +# 导入turtle模块,起别名t +import turtle as t + +t.speed(0) # 设置绘图速度为最快 +for i in range(6): + # 画正方形 + for j in range(4): + t.forward(100) + t.left(90) + t.left(60) # 左转60度 +t.done() diff --git a/第3讲转啊转啊转/课堂成果/画正方形(简化版).py b/第3讲转啊转啊转/课堂成果/画正方形(简化版).py new file mode 100644 index 0000000..6b8d77e --- /dev/null +++ b/第3讲转啊转啊转/课堂成果/画正方形(简化版).py @@ -0,0 +1,8 @@ +# 导入turtle模块,起别名t +import turtle as t + +for i in range(4): + t.forward(100) # 画边长 + t.left(90) # 左转90度 + +t.done() diff --git a/第3讲转啊转啊转/课堂成果/课后作业_一个圈9个三角形.py b/第3讲转啊转啊转/课堂成果/课后作业_一个圈9个三角形.py new file mode 100644 index 0000000..f203a64 --- /dev/null +++ b/第3讲转啊转啊转/课堂成果/课后作业_一个圈9个三角形.py @@ -0,0 +1,11 @@ +# 导入turtle模块,起别名t +import turtle as t + +t.speed(0) # 设置绘图速度为最快 +for i in range(9): + # 画三角形 + for j in range(3): + t.forward(100) + t.left(120) + t.left(40) # 左转40度 +t.done() diff --git a/第3讲转啊转啊转/课堂成果/转啊转啊转.py b/第3讲转啊转啊转/课堂成果/转啊转啊转.py new file mode 100644 index 0000000..d6d46a1 --- /dev/null +++ b/第3讲转啊转啊转/课堂成果/转啊转啊转.py @@ -0,0 +1,11 @@ +# 导入turtle模块,起别名t +import turtle as t + +t.speed(0) # 设置绘图速度为最快 +for i in range(6): + # 画正方形 + for j in range(4): + t.forward(100) + t.left(90) + t.left(60) # 左转60度 +t.done() diff --git a/第3讲转啊转啊转/转啊转啊转.png b/第3讲转啊转啊转/转啊转啊转.png new file mode 100644 index 0000000..a793e39 Binary files /dev/null and b/第3讲转啊转啊转/转啊转啊转.png differ diff --git a/第40讲 知识树/40知识树讲义.pdf b/第40讲 知识树/40知识树讲义.pdf new file mode 100644 index 0000000..8c6040c Binary files /dev/null and b/第40讲 知识树/40知识树讲义.pdf differ diff --git a/第40讲 知识树/知识树.png b/第40讲 知识树/知识树.png new file mode 100644 index 0000000..76e12bb Binary files /dev/null and b/第40讲 知识树/知识树.png differ diff --git a/第40讲 知识树/课堂成果/《知识树》+《回望与前行》课程资源.7z b/第40讲 知识树/课堂成果/《知识树》+《回望与前行》课程资源.7z new file mode 100644 index 0000000..45725bd Binary files /dev/null and b/第40讲 知识树/课堂成果/《知识树》+《回望与前行》课程资源.7z differ diff --git a/第40讲 知识树/课堂成果/树干.png b/第40讲 知识树/课堂成果/树干.png new file mode 100644 index 0000000..18b38a9 Binary files /dev/null and b/第40讲 知识树/课堂成果/树干.png differ diff --git a/第40讲 知识树/课堂成果/知识树.py b/第40讲 知识树/课堂成果/知识树.py new file mode 100644 index 0000000..ade6f2f --- /dev/null +++ b/第40讲 知识树/课堂成果/知识树.py @@ -0,0 +1,49 @@ +import turtle +import random + +# 设置屏幕 +turtle.bgpic("树干.png") + +# 创建画笔 +pen = turtle.Turtle() +# 隐藏画笔 +pen.hideturtle() + +# 创建颜色列表 +colors = ["red", "orange", "green", "blue", "purple", "pink", "black"] + + +# 画花花 +def draw_flower(x, y): + # 移动画笔但不绘制 + pen.penup() + pen.goto(x, y) + pen.pendown() + + # 随机选择花瓣颜色 + pen_color = random.choice(colors) + # 设置画笔和填充颜色 + pen.color(pen_color) + + # 开始填充颜色 + pen.begin_fill() + # 画出一个小花 + for i in range(5): + pen.circle(10) + pen.right(72) + # 填充完成 + pen.end_fill() + + # 绘制黄色花蕊 + pen.color("yellow") + pen.dot(8) + + +# 窗口点击事件监听 +turtle.onscreenclick(draw_flower) + +# 将窗口刷新关闭 +turtle.tracer(0) + +# 停止画笔绘制,但绘图窗体不关闭 +turtle.done() diff --git a/第40讲 知识树/课堂成果/课后作业-点点星光.py b/第40讲 知识树/课堂成果/课后作业-点点星光.py new file mode 100644 index 0000000..1acb895 --- /dev/null +++ b/第40讲 知识树/课堂成果/课后作业-点点星光.py @@ -0,0 +1,37 @@ +import turtle +import random + +# 设置屏幕 +turtle.bgpic("黑夜.png") +# 创建画笔 +pen = turtle.Turtle() +# 隐藏画笔 +pen.hideturtle() +# 设置画笔和填充颜色 +pen.color("yellow") + + +# 画星星 +def draw_star(x, y): + # 移动画笔但不绘制 + pen.penup() + pen.goto(x, y) + pen.pendown() + + pen.begin_fill() + # 画出一个星星 + for i in range(5): + pen.forward(10) + pen.left(144) + pen.end_fill() + + +# 窗口点击事件监听 +turtle.onscreenclick(draw_star) + +# 将窗口刷新关闭 +turtle.tracer(0) + +# 停止画笔绘制,但绘图窗体不关闭 +turtle.done() + diff --git a/第40讲 知识树/课堂成果/黑夜.png b/第40讲 知识树/课堂成果/黑夜.png new file mode 100644 index 0000000..34c70bc Binary files /dev/null and b/第40讲 知识树/课堂成果/黑夜.png differ diff --git a/第41讲 回望与前行/41回望与前行讲义.pdf b/第41讲 回望与前行/41回望与前行讲义.pdf new file mode 100644 index 0000000..28da6c3 Binary files /dev/null and b/第41讲 回望与前行/41回望与前行讲义.pdf differ diff --git a/第41讲 回望与前行/回望与前行.png b/第41讲 回望与前行/回望与前行.png new file mode 100644 index 0000000..ce0cd51 Binary files /dev/null and b/第41讲 回望与前行/回望与前行.png differ diff --git a/第41讲 回望与前行/课堂成果/《知识树》+《回望与前行》课程资源.7z b/第41讲 回望与前行/课堂成果/《知识树》+《回望与前行》课程资源.7z new file mode 100644 index 0000000..45725bd Binary files /dev/null and b/第41讲 回望与前行/课堂成果/《知识树》+《回望与前行》课程资源.7z differ diff --git a/第41讲 回望与前行/课堂成果/安装第三方库.py b/第41讲 回望与前行/课堂成果/安装第三方库.py new file mode 100644 index 0000000..bef3c4e --- /dev/null +++ b/第41讲 回望与前行/课堂成果/安装第三方库.py @@ -0,0 +1,7 @@ +# 点击运行【安装第三方库.py】,即可安装本课用到的第三方库 + +import pip +pip.main(['install','jieba']) +pip.main(['install','wordcloud']) +#pip.main(['install','pillow']) +#pip.main(['install','numpy']) \ No newline at end of file diff --git a/第41讲 回望与前行/课堂成果/心.png b/第41讲 回望与前行/课堂成果/心.png new file mode 100644 index 0000000..31476b3 Binary files /dev/null and b/第41讲 回望与前行/课堂成果/心.png differ diff --git a/第41讲 回望与前行/课堂成果/蝴蝶.png b/第41讲 回望与前行/课堂成果/蝴蝶.png new file mode 100644 index 0000000..e7fbd58 Binary files /dev/null and b/第41讲 回望与前行/课堂成果/蝴蝶.png differ diff --git a/第41讲 回望与前行/课堂成果/词云新体验.py b/第41讲 回望与前行/课堂成果/词云新体验.py new file mode 100644 index 0000000..d3765b1 --- /dev/null +++ b/第41讲 回望与前行/课堂成果/词云新体验.py @@ -0,0 +1,36 @@ +# 运行程序前,请务必前往本课包【课程说明】处,下载课程素材,完成配置 +# 编程前,运行【安装第三方库.py】文件,安装本课用到的第三方库 + +import jieba +import wordcloud +from PIL import Image +import numpy as np + +# 加载背景图片 +mask_image = np.array(Image.open("蝴蝶.png")) + +with open('开学前一夜.txt', 'r', encoding='utf-8') as f: + text = f.read() + +lst = jieba.lcut(text) +m = ' '.join(lst) + +print('开始制作词云...') + +w = wordcloud.WordCloud( + font_path = '大梁体繁简.TTF', + stopwords = ['你',"我","是",'的'], + # 使用参数background_color设置图片背景 + background_color = None, + mode = 'RGBA', + mask = mask_image +) + +w.generate(m) +w.to_file('词云.png') + +print('词云图片已生成,开始展示图片') + +p = Image.open('词云.png') +p.show() +print('图片展示完成') diff --git a/第41讲 回望与前行/课堂成果/课后作业-春.py b/第41讲 回望与前行/课堂成果/课后作业-春.py new file mode 100644 index 0000000..aec1ad7 --- /dev/null +++ b/第41讲 回望与前行/课堂成果/课后作业-春.py @@ -0,0 +1,37 @@ +# 运行程序前,请务必前往本课包【课程说明】处,下载课程素材,完成配置 +# 编程前,运行【安装第三方库.py】文件,安装本课用到的第三方库 + +import jieba +import wordcloud +from PIL import Image +import numpy as np + +# 加载背景图片 +mask_image = np.array(Image.open("心.png")) + +with open('春.txt', 'r', encoding='utf-8') as f: + text = f.read() + +lst = jieba.lcut(text) +m = ' '.join(lst) + +print('开始制作词云...') + +w = wordcloud.WordCloud( + font_path = '大梁体繁简.TTF', + stopwords = ['着',"了","里",'的'], + # 使用参数background_color设置图片背景 + background_color = None, + mode = 'RGBA', + mask = mask_image +) + +w.generate(m) +w.to_file('词云-春.png') + +print('词云图片已生成,开始展示图片') + +p = Image.open('词云-春.png') +p.show() +print('图片展示完成') + diff --git a/第4讲海龟岛的试炼(一)/04海龟岛的试炼一讲义.pdf b/第4讲海龟岛的试炼(一)/04海龟岛的试炼一讲义.pdf new file mode 100644 index 0000000..40dea4b Binary files /dev/null and b/第4讲海龟岛的试炼(一)/04海龟岛的试炼一讲义.pdf differ diff --git a/第4讲海龟岛的试炼(一)/海龟岛的试炼(一).png b/第4讲海龟岛的试炼(一)/海龟岛的试炼(一).png new file mode 100644 index 0000000..25ab378 Binary files /dev/null and b/第4讲海龟岛的试炼(一)/海龟岛的试炼(一).png differ diff --git a/第4讲海龟岛的试炼(一)/课堂成果/4_1 地图展开.py b/第4讲海龟岛的试炼(一)/课堂成果/4_1 地图展开.py new file mode 100644 index 0000000..4961da0 --- /dev/null +++ b/第4讲海龟岛的试炼(一)/课堂成果/4_1 地图展开.py @@ -0,0 +1,4 @@ +import turtle as t +t.setup(800,600,0,0) +t.screensize(1000,800,'blue') +t.done() diff --git a/第4讲海龟岛的试炼(一)/课堂成果/4_2 简笔画灯泡.py b/第4讲海龟岛的试炼(一)/课堂成果/4_2 简笔画灯泡.py new file mode 100644 index 0000000..7a62324 --- /dev/null +++ b/第4讲海龟岛的试炼(一)/课堂成果/4_2 简笔画灯泡.py @@ -0,0 +1,30 @@ +import turtle as t +t.shape('turtle') +# 不画线,移到(0,200) +t.penup() +t.goto(0,200) +t.pendown() +# 画线(0,200)——>(0,0) +t.goto(0,0) +# 画长方形(0,0)——>(50,0)——>(50,-25)——>(-50,-25)——>(-50,0)——>(0,0) +t.setx(50) +t.sety(-25) +t.setx(-50) +t.sety(0) +t.setx(0) +# 不画线,移到(-50,-25) +t.penup() +t.goto(-50,-25) +t.pendown() +# 画梯形(-50,-25)——>(50,-25)——>(150,-75)——>(-150,-75)——>(-50,-25) +t.setx(50) +t.goto(150,-75) +t.setx(-150) +t.goto(-50,-25) +#不画线,移到(0,-100) +t.penup() +t.goto(0,-100) +t.pendown() +#画圆 +t.circle(30) +t.done() diff --git a/第4讲海龟岛的试炼(一)/课堂成果/课后作业_机器人.py b/第4讲海龟岛的试炼(一)/课堂成果/课后作业_机器人.py new file mode 100644 index 0000000..2d5bc4e --- /dev/null +++ b/第4讲海龟岛的试炼(一)/课堂成果/课后作业_机器人.py @@ -0,0 +1,35 @@ +# 初始设置 +import turtle as t + +# 画方脸 +for i in range(4): + t.forward(100) + t.left(90) + +# 不画线,移到(30,20) +t.penup() +t.goto(30,20) +t.pendown() + +# 画三角形嘴巴 +for i in range(3): + t.forward(40) + t.left(120) + +# 不画线,移到(20,80) +t.penup() +t.goto(20,80) +t.pendown() + +# 画左眼睛 +t.dot(20) + +# 不画线,移到(80,80) +t.penup() +t.goto(80,80) +t.pendown() + +# 画右眼睛 +t.dot(20) + +t.done() diff --git a/第5讲海龟岛的试炼(二)/05海龟岛的试炼二讲义.pdf b/第5讲海龟岛的试炼(二)/05海龟岛的试炼二讲义.pdf new file mode 100644 index 0000000..c43db04 Binary files /dev/null and b/第5讲海龟岛的试炼(二)/05海龟岛的试炼二讲义.pdf differ diff --git a/第5讲海龟岛的试炼(二)/海龟岛的试炼(二).png b/第5讲海龟岛的试炼(二)/海龟岛的试炼(二).png new file mode 100644 index 0000000..303393b Binary files /dev/null and b/第5讲海龟岛的试炼(二)/海龟岛的试炼(二).png differ diff --git a/第5讲海龟岛的试炼(二)/课堂成果/终极考验_彩色风车.py b/第5讲海龟岛的试炼(二)/课堂成果/终极考验_彩色风车.py new file mode 100644 index 0000000..7ead4b6 --- /dev/null +++ b/第5讲海龟岛的试炼(二)/课堂成果/终极考验_彩色风车.py @@ -0,0 +1,55 @@ +#初始设置 +import turtle as t +t.shape('turtle') #海龟形状 +t.bgcolor('pink') #粉色背景 +t.pencolor('black') #黑色画笔 +t.pensize(10) #画笔宽度为10 + +#移到(0,-200),不留下痕迹 +t.penup() +t.goto(0,-200) +t.pendown() +#画竖线 +t.goto(0,0) + +#画红色扇叶 +t.fillcolor('red') #红色填充 +t.begin_fill() #开始填充 +t.seth(0) #朝向右 +t.forward(100) #前进100像素 +t.left(90) #左转90°,朝向左 +t.circle(100,45) #画扇叶圆弧,角度45 +t.goto(0,0) #回到原点 +t.end_fill() #结束填充 + +#画黄色扇叶 +t.fillcolor('yellow') #黄色填充 +t.begin_fill() #开始填充 +t.seth(90) #朝向上 +t.forward(100) #前进100像素 +t.left(90) #左转90°,朝向左 +t.circle(100,45) #画扇叶圆弧,角度45 +t.goto(0,0) #回到原点 +t.end_fill() #结束填充 + +#画绿色扇叶 +t.fillcolor('green') #绿色填充 +t.begin_fill() #开始填充 +t.seth(180) #朝向左 +t.forward(100) #前进100像素 +t.left(90) #左转90°,朝向下 +t.circle(100,45) #画扇叶圆弧,角度45 +t.goto(0,0) #回到原点 +t.end_fill() #结束填充 + +#画蓝色扇叶 +t.fillcolor('blue') #蓝色填充 +t.begin_fill() #开始填充 +t.seth(270) #朝向下 +t.forward(100) #前进100像素 +t.left(90) #左转90°,朝向右 +t.circle(100,45) #画扇叶圆弧,角度45 +t.goto(0,0) #回到原点 +t.end_fill() #结束填充 + +t.done() diff --git a/第5讲海龟岛的试炼(二)/课堂成果/课后作业_多彩机器人.py b/第5讲海龟岛的试炼(二)/课堂成果/课后作业_多彩机器人.py new file mode 100644 index 0000000..7947f32 --- /dev/null +++ b/第5讲海龟岛的试炼(二)/课堂成果/课后作业_多彩机器人.py @@ -0,0 +1,44 @@ +# 初始设置 +import turtle as t +t.bgcolor('orange') # 橙色背景 +t.pensize(5) # 画笔宽度为5 + +# 画方脸 +t.fillcolor('blue') +t.begin_fill() +for i in range(4): + t.forward(100) + t.left(90) +t.end_fill() + +# 不画线,移到(30,20) +t.penup() +t.goto(30,20) +t.pendown() + +# 画三角形嘴巴 +t.fillcolor('red') +t.begin_fill() +for i in range(3): + t.forward(40) + t.left(120) +t.end_fill() + +# 不画线,移到(20,80) +t.penup() +t.goto(20,80) +t.pendown() + +# 画左眼睛 +t.dot(20) + +# 不画线,移到(80,80) +t.penup() +t.goto(80,80) +t.pendown() + +# 画右眼睛 +t.dot(20) +t.hideturtle() # 下节课学习,想使用的话可以提前给孩子们介绍一下 + +t.done() diff --git a/第6讲送你一朵小红花/06送你一朵小红花讲义.pdf b/第6讲送你一朵小红花/06送你一朵小红花讲义.pdf new file mode 100644 index 0000000..c5ad4af Binary files /dev/null and b/第6讲送你一朵小红花/06送你一朵小红花讲义.pdf differ diff --git a/第6讲送你一朵小红花/课堂成果/送你一朵小红花.py b/第6讲送你一朵小红花/课堂成果/送你一朵小红花.py new file mode 100644 index 0000000..af3f6b9 --- /dev/null +++ b/第6讲送你一朵小红花/课堂成果/送你一朵小红花.py @@ -0,0 +1,36 @@ +#导入模块,设置画笔尺寸 +import turtle as t +t.pensize(10) +#设置初始位置 +t.penup() +t.goto(0,-300) +t.pendown() +#绘制叶片 +t.color('green','green') +t.begin_fill() +t.setheading(90) +t.circle(150,80) +t.setheading(-90) +t.circle(150,80) +t.setheading(90) +t.circle(-150,80) +t.setheading(-90) +t.circle(-150,80) +t.end_fill() +#绘制花杆 +t.pencolor('brown') +t.goto(0,0) +#绘制花瓣 +t.setheading(0) +t.color('red','red') +t.begin_fill() +for i in range(5): + t.circle(50) + t.left(72) +t.end_fill() +#绘制花蕊 +t.pencolor('yellow') +t.dot(100) +#隐藏画笔 +t.hideturtle() +t.done() \ No newline at end of file diff --git a/第6讲送你一朵小红花/送你一朵小红花.png b/第6讲送你一朵小红花/送你一朵小红花.png new file mode 100644 index 0000000..ffd78be Binary files /dev/null and b/第6讲送你一朵小红花/送你一朵小红花.png differ diff --git a/第7讲彩虹屁生成器/07彩虹屁生成器讲义.pdf b/第7讲彩虹屁生成器/07彩虹屁生成器讲义.pdf new file mode 100644 index 0000000..64cda5d Binary files /dev/null and b/第7讲彩虹屁生成器/07彩虹屁生成器讲义.pdf differ diff --git a/第7讲彩虹屁生成器/彩虹屁生成器.png b/第7讲彩虹屁生成器/彩虹屁生成器.png new file mode 100644 index 0000000..79c6278 Binary files /dev/null and b/第7讲彩虹屁生成器/彩虹屁生成器.png differ diff --git a/第7讲彩虹屁生成器/课堂成果/hello某某.py b/第7讲彩虹屁生成器/课堂成果/hello某某.py new file mode 100644 index 0000000..4bc56cd --- /dev/null +++ b/第7讲彩虹屁生成器/课堂成果/hello某某.py @@ -0,0 +1,4 @@ +#请在这里编写代码 +num1 = int(input("数字1:")) +num2 = int(input("数字2:")) +print(num1 + num2) \ No newline at end of file diff --git a/第7讲彩虹屁生成器/课堂成果/加法(方法1).py b/第7讲彩虹屁生成器/课堂成果/加法(方法1).py new file mode 100644 index 0000000..4bc56cd --- /dev/null +++ b/第7讲彩虹屁生成器/课堂成果/加法(方法1).py @@ -0,0 +1,4 @@ +#请在这里编写代码 +num1 = int(input("数字1:")) +num2 = int(input("数字2:")) +print(num1 + num2) \ No newline at end of file diff --git a/第7讲彩虹屁生成器/课堂成果/加法(方法2).py b/第7讲彩虹屁生成器/课堂成果/加法(方法2).py new file mode 100644 index 0000000..162b827 --- /dev/null +++ b/第7讲彩虹屁生成器/课堂成果/加法(方法2).py @@ -0,0 +1,4 @@ +#请在这里编写代码 +num1 = input("数字1:") +num2 = input("数字2:") +print(int(num1) + int(num2)) \ No newline at end of file diff --git a/第7讲彩虹屁生成器/课堂成果/彩虹屁生成器(一个print).py b/第7讲彩虹屁生成器/课堂成果/彩虹屁生成器(一个print).py new file mode 100644 index 0000000..e2e8dd0 --- /dev/null +++ b/第7讲彩虹屁生成器/课堂成果/彩虹屁生成器(一个print).py @@ -0,0 +1,6 @@ +#请在这里编写代码 +name = input("顾客姓名:") +sayHi = input("打招呼语:") +praise = input("称赞语:") +goods = input("推荐货物:") +print(name+","+sayHi+",你还是那么"+praise+"。今天店里的"+goods+"品质很不错,要来一些吗?") \ No newline at end of file diff --git a/第7讲彩虹屁生成器/课堂成果/彩虹屁生成器(两个print).py b/第7讲彩虹屁生成器/课堂成果/彩虹屁生成器(两个print).py new file mode 100644 index 0000000..c734431 --- /dev/null +++ b/第7讲彩虹屁生成器/课堂成果/彩虹屁生成器(两个print).py @@ -0,0 +1,7 @@ +#请在这里编写代码 +name = input("顾客姓名:") +sayHi = input("打招呼语:") +praise = input("称赞语:") +goods = input("推荐货物:") +print(name , sayHi , "你还是那么" + praise , sep = "," , end = "。") +print("今天店里的" + goods + "品质很不错,要来一些吗?") \ No newline at end of file diff --git a/第7讲彩虹屁生成器/课堂成果/课后作业_介绍我的同桌.py b/第7讲彩虹屁生成器/课堂成果/课后作业_介绍我的同桌.py new file mode 100644 index 0000000..2f6e1ed --- /dev/null +++ b/第7讲彩虹屁生成器/课堂成果/课后作业_介绍我的同桌.py @@ -0,0 +1,7 @@ +#请在这里编写代码 +name = input("同桌姓名:") +sex = input("性别:") +hobby = input("爱好:") +print("我的同桌叫" + name) +print("ta的性别是" + sex) +print("ta的爱好是" + hobby) \ No newline at end of file diff --git a/第8讲收银员的苦恼/08收银员的苦恼讲义.pdf b/第8讲收银员的苦恼/08收银员的苦恼讲义.pdf new file mode 100644 index 0000000..65a5bf1 Binary files /dev/null and b/第8讲收银员的苦恼/08收银员的苦恼讲义.pdf differ diff --git a/第8讲收银员的苦恼/收银员的苦恼.png b/第8讲收银员的苦恼/收银员的苦恼.png new file mode 100644 index 0000000..f64542e Binary files /dev/null and b/第8讲收银员的苦恼/收银员的苦恼.png differ diff --git a/第8讲收银员的苦恼/课堂成果/收银员的烦恼.py b/第8讲收银员的苦恼/课堂成果/收银员的烦恼.py new file mode 100644 index 0000000..d2ca424 --- /dev/null +++ b/第8讲收银员的苦恼/课堂成果/收银员的烦恼.py @@ -0,0 +1,10 @@ +#请在这里编写代码 +types = int(input("共购买多少种商品:")) +total = 0 +for i in range(types): + goods = input("该商品名称:") + price = float(input("该商品单价:")) + number = int(input("该商品数量:")) + print(f'商品名称:{goods},商品单价:{price},商品数量:{number}') + total = total + price * number +print(f'购买的商品总价为:{total}') \ No newline at end of file diff --git a/第8讲收银员的苦恼/课堂成果/课后作业_分糖果.py b/第8讲收银员的苦恼/课堂成果/课后作业_分糖果.py new file mode 100644 index 0000000..20c21a9 --- /dev/null +++ b/第8讲收银员的苦恼/课堂成果/课后作业_分糖果.py @@ -0,0 +1,4 @@ +#请在这里编写代码 +n = int(input("糖果总数为:")) +yours = n//4 +print(f"老师共买了{n}颗糖果,你最少可以分到{yours}颗") \ No newline at end of file diff --git a/第9讲亲开会员吗/09亲开会员吗讲义.pdf b/第9讲亲开会员吗/09亲开会员吗讲义.pdf new file mode 100644 index 0000000..f96be1e Binary files /dev/null and b/第9讲亲开会员吗/09亲开会员吗讲义.pdf differ diff --git a/第9讲亲开会员吗/亲,开会员吗.png b/第9讲亲开会员吗/亲,开会员吗.png new file mode 100644 index 0000000..e1f6592 Binary files /dev/null and b/第9讲亲开会员吗/亲,开会员吗.png differ diff --git a/第9讲亲开会员吗/课堂成果/亲,开会员吗.py b/第9讲亲开会员吗/课堂成果/亲,开会员吗.py new file mode 100644 index 0000000..646739c --- /dev/null +++ b/第9讲亲开会员吗/课堂成果/亲,开会员吗.py @@ -0,0 +1,15 @@ +#请在这里编写代码 +price_in = int(input("请输入您购买商品的总价:")) +price1 = price_in * 0.9 +if price_in >= 300: + price2 = price_in - 40 +else: + price2 = price_in +if price_in < 500: + price3 = price_in +else: + if price_in < 1000 : + price3 = price_in - 88 + else: + price3 = price_in - 188 +print(f'原价是:{price_in},三种方案优惠后价格依次为:{price1},{price2},{price3}') \ No newline at end of file diff --git a/第9讲亲开会员吗/课堂成果/课后作业_击败boss凶抓龙.py b/第9讲亲开会员吗/课堂成果/课后作业_击败boss凶抓龙.py new file mode 100644 index 0000000..7e6be86 --- /dev/null +++ b/第9讲亲开会员吗/课堂成果/课后作业_击败boss凶抓龙.py @@ -0,0 +1,14 @@ +#请在这里编写代码 +print("欢迎来到怪物的老巢。") +print("请打败boss凶爪龙,拯救无辜村民。") # 故事介绍 +boss_hp = 10 # 将boss的hp值预设为10 +print(f"boss凶爪龙的hp值为:{str(boss_hp)},准备开始战斗!") # 作战开始的提示 +for i in range(10): # 循环10次请求攻击 + attack = int(input("请输入数字1攻击boss凶爪龙:")) # 在attack(进攻)变量中记录输入的内容 + if attack == 1: # 如果输入的数据为1 + boss_hp = boss_hp - 1 # boss掉血1点 + print(f"boss凶爪龙的血量还剩:{str(boss_hp)},继续加油啊!") # 输出boss剩余血量 + if boss_hp == 0: # 如果boss的hp值为0,说明boss被击败 + print("大英雄,恭喜你击败boss凶爪龙!") # 输出游戏胜利提示 + else: # 如果攻击时输入的数据不是1 + print("请输入数字1进攻!!!") # 则会提示“请输入数字1进攻!!!” \ No newline at end of file