DAY3 循环判断语句 浙大疏锦行一、知识点1.1循环语句range()生成序列用于控制for循环次数左闭右开range(stop) # 从 0 开始到 stop-1range(start, stop) # 从 start 开始到 stop-1range(start, stop, step) # 从 start 开始步长为 step到 stop-1#循环 for tech in tech_list: # 逐个取出每个元素 print(tech) # 打印每个技术名称 #判断 if temperature 35: print(红色预警高温天气) elif temperature 28: print(黄色预警天气炎热) elif temperature 20: print(绿色提示适宜温度) else: print(蓝色预警注意保暖)二、题目age_str25 height_str1.75 score95 ageint(age_str) heightfloat(height_str) score_strstr(score) totalagescore print(f年龄整数{age},类型{type(age)}) print(f身高浮点数{height},类型{type(height)}) print(f分数字符串{score_str},类型{type(score_str)}) print(f年龄分数{total})passwordpython123 min_length8 lengthlen(password) str6password[:6] firstpassword[0] lastpassword[-1] judgestr6python print(f密码:{password}) print(f密码长度:{length}) if length8: print(长度符合要求) else: print(长度不符合要求) print(f首字符:{first},尾字符:{last}) print(f前6个字符{str6}) print(f前6个字符是否为python{judge})scores[85,92,78,65,95,88] excellent_count0 total_score0 for i in scores: total_scorei if(i90) : excellent_count1 lengthlen(scores) average_scoretotal_score/length print(f优秀分数个数{excellent_count}\n分数总和{total_score}\n平均分数{average_score:.3f})