当前位置:首页>python>《Python基础及应用》第3章 分支程序设计-3.2 简单分支程序设计

《Python基础及应用》第3章 分支程序设计-3.2 简单分支程序设计

  • 2026-03-23 20:13:58
《Python基础及应用》第3章 分支程序设计-3.2 简单分支程序设计

教学平台:Anaconda Jupyter Notebook

第3章 分支程序设计

3.2 简单分支程序设计 课程讲义

📋 本章学习目标

1.✅ 掌握if-else双路分支语句的语法结构和执行流程

2.✅ 理解并运用条件表达式简化代码

3.✅ 熟练使用单路分支if语句处理特定条件

4.✅ 掌握mathrandom两个标准库模块在分支结构中的应用

5.✅ 通过3个综合实例理解分支结构的实际应用场景

6.✅ 学会使用AI工具辅助学习Python分支结构

🔍 3.2.1 双路分支语句 if-else

3.2.1.1 知识点:什么是双路分支?

概念解析:

双路分支结构是程序设计中最基础的条件判断结构,它让程序具有了”决策能力”。就像你在CK食堂吃饭时面临的选择: - 如果余额 ≥ 15元 → 吃二楼精品套餐 - 否则(余额 < 15元)→ 吃一楼基础套餐

语法结构:

if 条件表达式:    # 条件为True时执行的代码块(if分支)    语句1    语句2    ...else:    # 条件为False时执行的代码块(else分支)    语句3    语句4    ...

关键记忆点:

1. ifelse后面必须加冒号:

2. 代码块通过缩进(4个空格)来标识,这是Python的特色! 

3. ifelse处于同一缩进层级,它们下面的代码块再缩进一层

3.2.1.2 代码演示:基础语法

# 示例1:判断CK校园卡余额是否充足balance = 12.5  # 校园卡余额(元)if balance >= 15:    print("✅ 余额充足,可以去二楼吃精品套餐")    print(f"   当前余额:{balance}元")else:    print("⚠️  余额不足,建议去一楼吃基础套餐")    print(f"   当前余额:{balance}元,还需{15-balance:.1f}元")

执行结果分析:

⚠️余额不足,建议去一楼吃基础套餐当前余额:12.5元,还需2.5元

程序执行流程图解:

开始判断:balance >= 15 ?├─ 是 ─→ 执行if代码块 ─→ 结束└─ 否 ─→ 执行else代码块 ─→ 结束

3.2.1.3 知识点串联:回顾第2章内容

串联1:比较运算符(回顾2.3.1节)

if语句中使用的条件表达式,正是第2章学习的关系运算

运算符

含义

示例

结果

>

大于

5 > 3

True

<

小于

5 < 3

False

>=

大于等于

balance >= 15

取决于变量值

<=

小于等于

score <= 60

取决于变量值

==

等于

name == "张三"

取决于变量值

!=

不等于

age != 18

取决于变量值

串联2:输入输出函数

结合input()if-else实现交互式程序:

# 示例2:CK图书馆座位预约系统print("=" * 40)print("    📚 CK图书馆座位预约系统")print("=" * 40)student_id = input("请输入学号:")seat_type = input("请选择座位类型(1-单人座/2-双人座):")if seat_type == "1":    print(f"\n✅ 学号{student_id}预约成功!")    print("   座位类型:单人静音区")    print("   位置:3楼A区")else:    print(f"\n✅ 学号{student_id}预约成功!")    print("   座位类型:双人讨论区")    print("   位置:2楼B区")    print("   ⚠️  请注意保持讨论音量")

3.2.1.4 进阶案例:嵌套条件判断

# 示例3:CK成绩等级判定系统(结合第2章数值运算)score = float(input("请输入期末考试成绩(0-100):"))if score >= 60:    # 及格分支内部继续判断等级    if score >= 90:        grade = "优秀"    elif score >= 80:        grade = "良好"    else:        grade = "中等"    print(f"🎉 恭喜!成绩{score}分,等级:{grade}(及格)")else:    makeup = 60 - score    print(f"😔 成绩{score}分,未及格")    print(f"   补考需要提高{makeup}分")    # 嵌套判断是否接近及格线    if score >= 50:        print("   💡 提示:距离及格线很近,补考加油!")    else:        print("   📚 建议:需要系统复习基础知识")

3.2.1.5 常见错误警示 ⚠️

错误1:忘记冒号

# ❌ 错误代码if score >=60print("及格")# ✅ 正确代码if score >=60:print("及格")

错误2:缩进不一致

# ❌ 错误代码(混用空格和Tab)if score >=60:print("及格")# 4空格print("恭喜")# 8空格(但可能是Tab)# ✅ 正确代码(统一4空格)if score >=60:print("及格")print("恭喜")

错误3:条件赋值混淆

# ❌ 错误:使用=而不是==if score =60:# 这是赋值,不是比较!print("及格")# ✅ 正确:使用==比较if score ==60:print("刚好及格")

🔍 3.2.2 条件表达式

3.2.2.1 知识点:什么是条件表达式?

概念解析:

条件表达式是if-else简写形式,也叫三元运算符(Ternary Operator)。它适合在需要根据条件给变量赋值时使用,能让代码更简洁。

对比记忆:

形式

代码量

适用场景

完整if-else

多行

需要执行多条语句

条件表达式

单行

只需要返回一个值/赋值

语法结构:

变量 = 真值 if 条件 else 假值

等价于:

if 条件:    变量 = 真值else:    变量 = 假值

3.2.2.2 代码演示:基础用法

# 示例4:CK快递柜取件码简化版package_weight = 2.5  # 包裹重量(kg)# 使用条件表达式判断是否需要大件柜locker_type = "大件柜" if package_weight > 5 else "标准柜"print(f"包裹重量:{package_weight}kg")print(f"请前往:{locker_type}")

执行结果:

包裹重量:2.5kg请前往:标准柜

3.2.2.3 进阶用法:嵌套条件表达式

虽然可以嵌套,但建议最多嵌套一层以保持可读性:

# 示例5:CK食堂消费等级判定(嵌套条件表达式)amount = float(input("请输入今日消费金额:"))# 嵌套条件表达式:判断消费等级level = "高消费" if amount > 30 else ("中等消费" if amount > 15 else "节俭消费")print(f"今日消费:{amount}元")print(f"消费等级:{level}")

3.2.2.4 知识点串联:结合第2章字符串处理

# 示例6:CK学生信息格式化输出(结合2.4节字符串)student_name = "李明"is_vip = True  # 是否图书馆VIP会员# 使用条件表达式构建状态字符串status = "🌟 VIP会员" if is_vip else "普通会员"welcome_msg = f"欢迎{student_name},{status}!"# 结合字符串方法(回顾2.4.3节)print(welcome_msg.center(40, "="))

3.2.2.5 最佳实践建议

适合使用条件表达式的情况:

- 简单的赋值操作 

- 返回值选择 

- 列表/字典推导式中

不适合使用的情况:

- 需要执行多条语句 

- 逻辑复杂(多层嵌套) 

- 需要打印输出或复杂计算

✅ 好的用法:简单赋值discount = 0.8 if is_student else 1.0❌ 不好的用法:执行多条语句(应该用if-else)不要这样写:result = (print("A"), do_something()) if x > 0 else (print("B"), do_other())

🔍 3.2.3 单路分支语句 if

3.2.3.1 知识点:什么是单路分支?

概念解析:

单路分支是只有if没有else的结构。它表示:“如果条件满足,就做点额外的事;不满足就什么都不做,继续往下走”。

就像你在CK上课: 

- 如果下雨了 → 带伞去教学楼 

- 没下雨 → 正常去(不需要特别做什么)

语法结构:

if 条件表达式:    # 条件为True时执行的代码块    语句1    语句2    ...# 继续执行后面的代码(无论条件是否满足)后续语句

3.2.3.2 代码演示:基础语法

# 示例7:CK上课提醒系统import datetime  # 标准库,获取当前时间today = datetime.datetime.now()hour = today.hourprint(f"当前时间:{today.strftime('%H:%M')}")# 单路分支:只在特定时间提醒if hour == 8:    print("⏰ 提醒:第一节课即将开始,请尽快到达教室!")if hour == 12:    print("🍚 提醒:午餐时间到,CK食堂人可能较多,建议错峰")# 无论是否触发提醒,都会执行下面的话print("祝你学习愉快!")

3.2.3.3 多个单路分支 vs 双路分支

关键区别:

score = 75# 情况A:多个单路if(独立判断,可能都执行)if score >= 60:    print("及格")  # 执行if score >= 80:    print("良好")  # 不执行(75<80)# 情况B:if-else(互斥,只执行一个)if score >= 80:    print("良好")  # 不执行else:    print("及格")  # 执行(因为75<80)

适用场景对比:

结构

特点

示例场景

多个单路if

各条件独立,可能同时触发

同时检查多个不相关的提醒条件

if-else

条件互斥,只执行一个

二选一的场景(及格/不及格)

3.2.3.4 实际案例:CK多条件检查系统

# 示例8:CK宿舍安全检查系统has_electric_heater = Truewindow_open = Falsetrash_full = Trueprint("🔍 开始宿舍安全检查...")# 多个独立的单路分支检查if has_electric_heater:    print("⚠️  发现违规电器:电暖气,请立即移除!")if window_open:    print("🪟 窗户未关,请注意防盗和防尘")if trash_full:    print("🗑️  垃圾桶已满,请及时清理")# 统计问题数量issues = sum([has_electric_heater, window_open, trash_full])if issues == 0:    print("✅ 宿舍检查通过,保持整洁!")else:    print(f"😟 发现{issues}个问题,请尽快整改")

3.2.3.5 知识点串联:结合第2章逻辑运算

# 示例9:CK选课系统(结合3.1.2节逻辑运算)course_name = "Python基础"current_students = 45max_students = 50is_major_course = True  # 是否专业课# 使用逻辑运算组合条件(回顾第3章3.1节)if current_students < max_students and is_major_course:    print(f"✅ {course_name} 选课成功!")    print(f"   当前人数:{current_students}/{max_students}")if not is_major_course and current_students >= max_students:    print(f"❌ {course_name} 已满员,请关注补选通知")# 单路分支检查特殊情况if current_students == max_students - 1:    print("⚡ 紧急提醒:该课程仅剩最后1个名额!")

🔍 3.2.4 两个标准库模块

3.2.4.1 知识点:math模块 - 数学计算的利器

模块导入:

import math  # 导入整个模块# 或from math import sqrt, pow, fabs  # 导入特定函数

常用函数与分支结构结合:

函数

功能

分支应用场景

math.sqrt(x)

平方根

判断是否为完全平方数

math.pow(x,y)

x的y次幂

数值范围判断

math.fabs(x)

绝对值

误差范围判断

math.ceil(x)

向上取整

资源分配计算

math.floor(x)

向下取整

成绩等级判定

math.pi

圆周率

几何计算

3.2.4.2 代码演示:math模块应用

import math# 示例10:CK体育课 BMI指数计算与分级height = float(input("请输入身高(米):"))weight = float(input("请输入体重(公斤):"))# 计算BMI:体重(kg) / 身高(m)的平方# 使用math.pow进行幂运算(回顾第2章数值运算)bmi = weight / math.pow(height, 2)print(f"\n您的BMI指数为:{bmi:.2f}")# 使用分支结构判断体重等级if bmi < 18.5:    status = "偏瘦"    advice = "建议加强营养,适当增肌"elif bmi < 24:    status = "正常"    advice = "保持良好生活习惯"elif bmi < 28:    status = "偏胖"    advice = "建议控制饮食,增加有氧运动"else:    status = "肥胖"    advice = "建议咨询校医院营养师"print(f"体重状态:{status}")print(f"健康建议:{advice}")# 使用math.floor计算理想体重范围的下限(身高m的平方 * 18.5)ideal_weight_low = math.floor(math.pow(height, 2) * 18.5)ideal_weight_high = math.floor(math.pow(height, 2) * 24)print(f"\n理想体重范围:{ideal_weight_low}kg - {ideal_weight_high}kg")

3.2.4.3 知识点:random模块 - 随机性的引入

模块导入与常用函数:

import random# 常用函数:random.random()      # 生成[0.0, 1.0)之间的随机浮点数random.randint(a, b) # 生成[a, b]之间的随机整数random.choice(seq)   # 从序列中随机选择一个元素random.shuffle(list) # 将列表随机打乱

3.2.4.4 代码演示:random模块与分支结合

import random# 示例11:CK食堂随机推荐系统print("🎲 CK食堂智能推荐系统")print("-" * 30)# 生成随机数决定推荐random.seed()  # 初始化随机种子luck_number = random.randint(1100)print(f"今日幸运数字:{luck_number}")# 基于随机数的分支推荐if luck_number <= 30:    floor = "一楼"    window = random.choice(["基础套餐""面食窗口""粥品窗口"])elif luck_number <= 70:    floor = "二楼"    window = random.choice(["精品小炒""川渝风味""轻食沙拉"])else:    floor = "三楼"    window = random.choice(["特色火锅""烧烤档口""甜品站"])print(f"🍽️  推荐前往:{floor} - {window}")print(f"   匹配度:{luck_number}%")# 随机决定是否发放优惠券if random.random() < 0.3:  # 30%概率    discount = random.choice([0.90.850.8])    print(f"\n🎉 恭喜获得今日优惠券!折扣:{discount*10:.0f}折")else:    print("\n💪 今日无优惠券,但健康饮食 priceless!")

3.2.4.5 综合案例:随机点名系统

import random# 示例12:CK课堂随机点名与成绩模拟students = ["张三""李四""王五""赵六""陈七""刘八""杨九""黄十"]# 随机选择一名学生selected = random.choice(students)print(f"🎯 随机选中:{selected}")# 模拟该学生的课堂表现(随机生成)attendance_score = random.randint(60100)  # 出勤分homework_score = random.randint(50100)    # 作业分quiz_score = random.randint(40100)        # 测验分# 使用math计算加权平均分(平时30%+作业40%+测验30%)final_score = math.ceil(attendance_score * 0.3 + homework_score * 0.4 + quiz_score * 0.3)print(f"\n📊 {selected}的课堂表现:")print(f"   出勤分:{attendance_score} | 作业分:{homework_score} | 测验分:{quiz_score}")print(f"   综合得分:{final_score}")# 分支判断评价等级if final_score >= 90:    comment = "🌟 表现优异,请继续保持!"elif final_score >= 75:    comment = "👍 表现良好,还有提升空间"elif final_score >= 60:    comment = "⚠️  勉强及格,需要更加努力"else:    comment = "🚨 表现不佳,建议课后找我谈话"print(f"\n评价:{comment}")

3.2.4.6 知识点串联:模块导入方式回顾

# 回顾第1章1.3.2节:模块引用的三种方式# 方式1:import 模块名(推荐,避免命名冲突)import mathprint(math.sqrt(16))  # 4.0# 方式2:from 模块名 import 函数名(简洁,但需注意冲突)from math import sqrt, powprint(sqrt(16))  # 4.0# 方式3:from 模块名 import *from math import *print(sqrt(16))  # 4.0# 在分支结构中,推荐使用方式1,代码可读性更好import randomif random.randint(110) > 5:    print("大数")else:    print("小数")

🔍 3.2.5 三个程序设计实例

实例1:CK智能快递柜系统 🚚

需求分析: 设计一个快递柜存件系统,根据包裹尺寸、重量和存放时长计算费用,并判断是否发送取件提醒。

完整代码:

import mathimport randomfrom datetime import datetime, timedeltaprint("=" * 50)print("       📦 CK校园智能快递柜系统 V1.0")print("=" * 50)# 输入包裹信息package_id = input("请输入取件码(4位数字):")length = float(input("请输入包裹长度(cm):"))width = float(input("请输入包裹宽度(cm):"))height = float(input("请输入包裹高度(cm):"))weight = float(input("请输入包裹重量(kg):"))# 计算体积(使用math.pow)volume = length * width * heightvolume_dm3 = volume / 1000  # 转换为立方分米print(f"\n包裹体积:{volume_dm3:.2f}立方分米")# 判断柜子类型(双路分支嵌套单路分支)if volume_dm3 > 30 or weight > 10:    locker_type = "超大柜"    base_fee = 3.0    print("📦 分配至:超大柜(适合大件/重物)")else:    if volume_dm3 > 15:        locker_type = "大柜"        base_fee = 2.0    elif volume_dm3 > 5:        locker_type = "中柜"        base_fee = 1.5    else:        locker_type = "小柜"        base_fee = 1.0    print(f"📦 分配至:{locker_type}")# 计算存放时长(模拟)storage_days = random.randint(15)  # 随机生成存放天数print(f"⏱️  已存放时长:{storage_days}天")# 费用计算(条件表达式简化代码)extra_fee = (storage_days - 1) * 0.5 if storage_days > 1 else 0total_fee = base_fee + extra_feeprint(f"\n💰 费用明细:")print(f"   基础费用:{base_fee}元")if extra_fee > 0:    print(f"   超时费用:{extra_fee}元({storage_days-1}天×0.5元)")print(f"   合计:{total_fee}元")# 智能提醒判断(单路分支组合)print(f"\n📱 智能提醒:")if storage_days >= 3:    print("   ⚠️  包裹已存放3天以上,请尽快取件!")if total_fee > 5:    print("   💡 费用较高,建议开通会员享受优惠")if weight > 5 and locker_type != "超大柜":    print("   🏋️ 包裹较重,建议携带小推车")print("=" * 50)print("感谢使用CK智能快递柜!")print("=" * 50)

知识点覆盖:

- ✅ if-else双路分支判断柜子类型 

- ✅ if-elif-else多路分支细分柜子规格 

- ✅ 单路分支组合实现多重提醒 

- ✅ 条件表达式计算超时费用 

- ✅ math模块用于体积计算 

- ✅ random模块模拟存放时长

实例2:CK奖学金评定系统 🏆

需求分析: 根据学生的综合成绩、社会实践、竞赛获奖情况评定奖学金等级。

完整代码:

import mathprint("=" * 50)print("       🏆 CK年度奖学金评定系统")print("=" * 50)# 输入学生信息student_name = input("请输入学生姓名:")student_id = input("请输入学号:")# 输入各项指标score_avg = float(input("请输入加权平均成绩(0-100):"))social_hours = int(input("请输入社会实践时长(小时):"))competition_award = input("是否有竞赛获奖(y/n):").lower() == 'y'paper_published = input("是否发表论文(y/n):").lower() == 'y'print(f"\n{'='*50}")print(f"📋 学生:{student_name}{student_id})")print(f"{'='*50}")# 计算综合成绩(使用math.ceil确保不向下取整)academic_score = score_avg * 0.6  # 学业占60%social_score = min(social_hours / 1020)  # 实践占20%,上限20分competition_score = (15 if competition_award else 0)  # 竞赛占15%paper_score = (5 if paper_published else 0)  # 论文占5%total_score = math.ceil(academic_score + social_score + competition_score + paper_score)print(f"\n📊 评分详情:")print(f"   学业成绩:{academic_score:.1f}分(权重60%)")print(f"   社会实践:{social_score:.1f}分(时长{social_hours}h)")print(f"   竞赛获奖:{competition_score}分")print(f"   科研成果:{paper_score}分")print(f"   总分:{total_score}分")# 奖学金等级判定(复杂分支结构)if total_score >= 95 and score_avg >= 90:    level = "特等奖学金"    amount = 8000    honor = "校长提名"elif total_score >= 90:    level = "一等奖学金"    amount = 5000    honor = "院级表彰"elif total_score >= 80:    level = "二等奖学金"    amount = 3000    honor = "班级表彰"elif total_score >= 70:    level = "三等奖学金"    amount = 1500    honor = "鼓励奖"else:    level = "无"    amount = 0    honor = "继续努力"# 特殊加分项(单路分支)if competition_award and paper_published:    print(f"\n🌟 特殊荣誉:学术竞赛双优奖(额外加分已计入)")print(f"\n🏅 评定结果:")print(f"   奖学金等级:{level}")if amount > 0:    print(f"   奖学金额:{amount}元")    print(f"   荣誉称号:{honor}")    print(f"\n🎉 恭喜{student_name}获得{level}!")else:    print(f"   很遗憾,本次未获得奖学金。")    print(f"   💪 建议:提高成绩至70分以上,多参与社会实践")print(f"\n{'='*50}")

程序设计亮点:

- ✅ 使用math.ceil确保分数计算公平性 

- ✅ 多条件组合判断(and连接) 

- ✅ 复杂的if-elif-else链式结构 

- ✅ 单路分支处理特殊荣誉 

- ✅ 格式化输出提升用户体验

实例3:CK图书馆智能选座系统 📚

需求分析: 根据时间、用户偏好、座位状态智能推荐最佳座位,并处理预约冲突。

完整代码:

import randomimport mathfrom datetime import datetimeprint("=" * 50)print("       📚 CK图书馆智能选座系统")print("=" * 50)# 获取当前时间now = datetime.now()current_hour = now.houris_weekend = now.weekday() >= 5  # 5=周六, 6=周日print(f"当前时间:{now.strftime('%Y-%m-%d %H:%M')}{'周末'if is_weekend else'工作日'}")# 模拟座位状态(实际应从数据库读取)seats = {    "静音区A": random.randint(020),    "讨论区B": random.randint(015),    "电脑区C": random.randint(010),    "窗边区D": random.randint(012)}total_seats = sum([20151012])  # 总座位数occupied = sum(seats.values())available = total_seats - occupiedprint(f"\n📊 实时座位情况(总{total_seats}个):")print(f"   已使用:{occupied}个 | 剩余:{available}个")# 判断高峰期(双路分支)if is_weekend or (8 <= current_hour <= 10 or 14 <= current_hour <= 16 or 19 <= current_hour <= 21):    is_peak = True    print("⏰ 当前为高峰期,座位紧张")else:    is_peak = False    print("🟢 当前为非高峰期,座位充足")# 用户偏好输入print(f"\n{'='*50}")print("请选择您的偏好(输入数字):")print("1. 安静学习(推荐静音区)")print("2. 小组讨论(推荐讨论区)")print("3. 使用电脑(推荐电脑区)")print("4. 采光良好(推荐窗边区)")preference = input("您的选择:")# 智能推荐算法(多路分支)recommended_zone = ""confidence = 0if preference == "1":    # 静音区逻辑    available_a = 20 - seats["静音区A"]    if available_a > 5:        recommended_zone = "静音区A"        confidence = math.floor((available_a / 20) * 100)    elif available_a > 0:        recommended_zone = "静音区A(仅剩少量)"        confidence = math.floor((available_a / 20) * 100)    else:        # 备选方案        recommended_zone = "窗边区D(静音区已满,推荐备选)"        confidence = 50elif preference == "2":    # 讨论区逻辑    available_b = 15 - seats["讨论区B"]    if is_peak and available_b < 3:        recommended_zone = "讨论区B(高峰期建议提前预约)"        confidence = 30    else:        recommended_zone = "讨论区B"        confidence = math.floor((available_b / 15) * 100)elif preference == "3":    # 电脑区逻辑    available_c = 10 - seats["电脑区C"]    if available_c == 0:        recommended_zone = "暂无电脑座位,建议自带设备去静音区"        confidence = 0    else:        recommended_zone = "电脑区C"        confidence = math.floor((available_c / 10) * 100)elif preference == "4":    # 窗边区逻辑    available_d = 12 - seats["窗边区D"]    if available_d > 0:        recommended_zone = "窗边区D"        confidence = math.floor((available_d / 12) * 100)    else:        recommended_zone = "静音区A(窗边区已满)"        confidence = 70else:    recommended_zone = "未识别偏好,默认推荐静音区A"    confidence = 60# 输出推荐结果print(f"\n{'='*50}")print(f"🎯 智能推荐结果")print(f"{'='*50}")print(f"推荐区域:{recommended_zone}")print(f"匹配度:{confidence}%")# 生成建议(单路分支组合)print(f"\n💡 系统建议:")if confidence < 30:    print("   该时段座位紧张,建议改期或寻找其他学习场所")if is_peak and "讨论区" in recommended_zone:    print("   高峰期讨论区较吵,建议使用耳机")if "电脑区" in recommended_zone:    print("   电脑区设备有限,建议携带充电器备用")if confidence > 80:    print("   当前座位充足,祝您学习愉快!")# 模拟预约确认confirm = input(f"\n是否确认预约该区域?(y/n):").lower()if confirm == 'y':    code = random.randint(10009999)    print(f"\n✅ 预约成功!")    print(f"   座位号:{recommended_zone[:3]}-{random.randint(1,20)}")    print(f"   验证码:{code}")    print(f"   有效期:今日{current_hour}:00-闭馆")    print(f"\n⚠️  请按时到达,15分钟内未签到将自动释放座位")else:    print("\n已取消预约,欢迎重新选择")print(f"\n{'='*50}")

系统特性:

 - ✅ 结合时间判断高峰期/非高峰期 

- ✅ 多维度条件判断(时间+偏好+座位状态) 

- ✅ 智能备选方案推荐 

- ✅ 多重单路分支提供个性化建议 

- ✅ random生成验证码和座位号 

- ✅ math计算匹配度百分比

🤖 AI辅助学习专区

📝 AI提示词模板1:基础概念强化

学习目标: 通过对话理解if-else的执行流程

复制以下提示词给AI:

我是Python初学者,正在学习if-else分支结构。请帮我:1. 用"重庆火锅选辣度"的生活例子,解释if-else的执行逻辑2. 画出这个例子的流程图(用文本字符画)3. 给出对应的Python代码4. 出3道判断题考我,等我回答后批改并解释要求:语言幽默,多用重庆本地元素(如解放碑、洪崖洞、轻轨等)

📝 AI提示词模板2:趣味编程练习

学习目标: 用分支结构创造有趣的程序

练习1:重庆景点推荐器

请为我编写一个Python程序:功能:输入游客的年龄、是否第一次来重庆、预算(高/中/低),推荐最适合的重庆景点组合要求:1. 使用if-elif-else结构2. 包含至少5个重庆真实景点(如洪崖洞、磁器口、武隆等)3. 考虑不同人群:老年人(平缓路线)、年轻人(网红打卡)、亲子(互动性强)4. 输出格式美观,包含emoji5. 最后给我3个测试用例,让我运行验证请直接给出完整的、可直接运行的Python代码。

练习2:CK校园生活模拟器

请为我设计一个"CK校园一天"的文字冒险游戏:场景:从早上起床到晚上睡觉,经历多个选择节点:- 起床:早起/卡点到 -> 影响早餐和座位- 上课:认真听/刷手机 -> 影响知识掌握度- 午餐:食堂/外卖 -> 影响金钱和健康- 下午:图书馆/宿舍/运动 -> 影响成绩和体力- 晚上:自习/游戏/社团 -> 影响期末成绩要求:1. 使用嵌套if-else结构2. 设计一个评分系统,最后输出"学霸"/"普通学生"/"咸鱼"等级3. 包含随机事件(如突然下雨、老师点名)4. 代码要有注释,方便我理解请给出完整代码,并解释关键的分支逻辑。

📝 AI提示词模板3:代码调试与优化

学习目标: 学会用AI检查代码错误并优化

使用场景: 当你写的代码报错时,或想改进代码质量

提示词模板:

请帮我检查/优化以下Python代码:【粘贴你的代码】要求:1. 如果有错误,指出具体行号和原因,并给出修正方案2. 如果没有错误,建议3个优化方向(如简化逻辑、增加异常处理、提高可读性)3. 给出优化后的完整代码4. 解释优化前后的对比,让我明白为什么这样改更好背景:这是CK大学[课程/作业/项目]的代码,使用Python 3.x,在Jupyter Notebook中运行。

进阶提示词(针对本章内容):

我写了以下使用if-else的代码,但感觉太冗长了:score = 85if score >= 90:grade = 'A'if score >= 80 and score < 90:grade = 'B'if score >= 70 and score < 80:grade = 'C'if score >= 60 and score < 70:grade = 'D'if score < 60:grade = 'F'请帮我:1. 分析这段代码的问题(提示:多个独立if的效率问题、条件冗余)2. 改写成使用if-elif-else的版本3. 再改写成使用条件表达式的单行版本(如果可能)4. 比较三种写法的优缺点

📝 AI提示词模板4:创意项目挑战

学习目标: 综合运用分支结构完成有趣项目

项目1:爱心代码生成器 💝

请为我编写一个Python程序,使用分支结构和数学函数生成ASCII艺术爱心图案:要求:1. 让用户选择爱心大小(小/中/大)2. 让用户选择是否填充(空心/实心)3. 让用户选择字符(默认'*',也可输入其他字符如'#'、'❤'等)4. 使用if-else处理不同选择组合5.bonus:如果用户输入"重庆",显示"我❤️重庆"字样请给出完整代码,并解释如何用if-else控制图案生成逻辑。

项目2:重庆天气穿搭助手 ☂️

请为我编写一个实用的重庆天气穿搭推荐程序:功能:1. 输入当前温度(℃)、天气状况(晴/阴/雨)、是否有风2. 根据重庆"魔幻天气"特点给出穿搭建议重庆特色考虑:- 温度:夏季40℃+高温,冬季湿冷- 天气:多雾(雾都)、突发降雨- 地形:爬坡上坎,建议舒适鞋子分支逻辑要求:- 使用嵌套if处理温度区间内的天气细分- 使用单路if叠加特殊提醒(如高温+晴天=防晒提醒,雨天+有风=带伞提醒)- 使用条件表达式简化某些赋值输出示例:"🌡️ 35℃ 晴天 无风""👕 推荐:短袖+防晒衣""👟 鞋子:透气运动鞋(今日有体育课)""☂️ 建议:带遮阳伞,重庆夏天紫外线强"请给出完整代码。

📝 AI提示词模板5:知识串联复习

学习目标: 让AI帮你建立章节间的知识联系

我正在学习Python,请帮我串联以下知识点:当前章节:第3章 分支结构(if-else)已学章节:第1章(基础)、第2章(数据类型、运算符、输入输出)请设计一个综合编程练习,要求:1. 必须包含if-else分支结构(至少3种不同用法)2. 必须回顾第2章的至少3个知识点(如字符串切片、类型转换、格式化输出)3. 场景设定:CK大学[图书馆/食堂/宿舍/教室]的真实场景4. 难度:适合大一数字经济专业学生5. 提供:题目描述 → 思路提示 → 参考答案 → 变式拓展题请确保题目有趣且实用,不要枯燥的数学题。

📚 课后作业与练习

基础练习(必做)

1.CK成绩判定器:输入平时成绩(30%)和期末成绩(70%),计算总评并输出等级(A/B/C/D/F)

2.快递费计算器:输入包裹重量,首重1kg内10元,续重每kg 5元(不足1kg按1kg计),使用条件表达式简化计算

3.闰年判断:输入年份,判断是否为闰年(能被4整除但不能被100整除,或能被400整除)

进阶挑战(选做)

4.CK选课冲突检测:输入两门课的时间(星期几+节次),判断是否冲突

5.简易计算器:输入两个数和运算符(+、-、*、/),使用分支结构执行相应运算(注意除零判断)

AI辅助作业提交要求

完成编程作业后,使用以下提示词让AI帮你检查:

请帮我检查这段代码是否符合Python编程规范:【粘贴代码】检查要点:1. 缩进是否正确(4空格)2. 变量命名是否清晰(小写+下划线)3. 是否处理了异常情况(如输入非数字)4. if-else结构是否可以优化5. 是否添加了必要的注释请给出评分(满分10分)和具体改进建议。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-03-27 09:52:36 HTTP/2.0 GET : https://f.mffb.com.cn/a/482408.html
  2. 运行时间 : 0.227825s [ 吞吐率:4.39req/s ] 内存消耗:4,981.20kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=e3d7e694bdac4e5de04485727479bcc0
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000917s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001353s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.002026s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000672s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001325s ]
  6. SELECT * FROM `set` [ RunTime:0.000648s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001397s ]
  8. SELECT * FROM `article` WHERE `id` = 482408 LIMIT 1 [ RunTime:0.001284s ]
  9. UPDATE `article` SET `lasttime` = 1774576356 WHERE `id` = 482408 [ RunTime:0.002206s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000552s ]
  11. SELECT * FROM `article` WHERE `id` < 482408 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001189s ]
  12. SELECT * FROM `article` WHERE `id` > 482408 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001159s ]
  13. SELECT * FROM `article` WHERE `id` < 482408 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.004442s ]
  14. SELECT * FROM `article` WHERE `id` < 482408 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.012907s ]
  15. SELECT * FROM `article` WHERE `id` < 482408 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002923s ]
0.233889s