2026信息素养智能算法应用初赛-数字守艺人-初中组python-8_第1页
2026信息素养智能算法应用初赛-数字守艺人-初中组python-8_第2页
2026信息素养智能算法应用初赛-数字守艺人-初中组python-8_第3页
2026信息素养智能算法应用初赛-数字守艺人-初中组python-8_第4页
2026信息素养智能算法应用初赛-数字守艺人-初中组python-8_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1.在模拟长征路线物资调度场景中,需要统计不同重量的粮食袋总数,下列Python代码片段中,能正A.count={};forwinfood_weights:count[w]=count[w]+1B.count={};forwinfood_weights:count[w]=count.get(w,0)+1C.count=[];forwinfood_weights:count.append(food_weights.count(w))D.count=set();forwinfood_weights:count.add((w,food_weights.count(w)))×0.7+地形复杂度×0.3,其中地形复杂度取值范围是1-10,下列Python函数能正确实现该计算的是A.defcalculate_difficulty(troops,terrain):returntroops0.7+terrain0.3B.defcalculate_difficulty(troops,terrain):returntroops*0.7+max(1,min(terrain,10))0.3C.defcalculate_difficulty(troops,terrain):returntroops+terrain0.3D.defcalculate_difficulty(troops,terrain):return(troops+terrain)*0.5A.sorted(read_counts)B.sorted(read_counts.values(),reverse=True)C.sorted(read_counts.items(),key=lambdax:x[1],reverse=True)D.sorted(read_counts.keys(),key=lambdax:read_counts[x])4.长征片段路线设计中,需要判断某段道路是否适合行军,判断条件为:道路宽度≥2米,度,同时天气不是暴雨,下列Python条件表达式正确的是A.width>=2orslope<=30andweather!="暴雨"B.width>=2andslope<=30orweather!="暴雨"C.(width>=2andslope<=30)andweather!="暴雨"D.width>=2and(slope<=30orweather!="暴雨")5.某红色根据地粮食储备数据存储在列表graC.找出列表中的三个最大值相加的1.5倍及以上时胜率为90%,1倍到1.5倍之间胜率为60%,不足1倍时胜率为20%,下列PythonA.defcalculate_win_rate(our,enemy):ifour>=enemy1.5:return90elifour>=enemy:return60else:return20B.defcalculate_win_rate(our,enemy):ifour>enemy1.5:return90elifour>enemy:return60else:return20C.defcalculate_win_rate(our,enemy):rate=our/enemyreturn90ifrate>=1.5else60ifrate>=1else20A.count={};whileTrue:word=input();ifword=="结束":break;count[word]=count.get(word,0)+1B.count={};word=input();whileword!="结束":count[word]+=1;word=input()C.count=[];whileTrue:word=input();ifword=="结束":break;count.append(word)D.count=set();whileTrue:word=input();ifword=="结束":break;count.add(word)适适A.列表:"瑞金",440,0],["遵义",840,3409.某红色根据地水利设施建设进度数据为progress=[30,45,6A.foriinrange(len(progress)):print(progress[i]-progress[i-1])B.foriinrange(1,len(progress)):print(progress[i]-progress[i-1])C.foriinrange(len(progress)-1):print(progress[i+1]-progress[i])10.在模拟红色战役兵力部署场景中,需要将总兵力按3:2:1的比例分A.a=total_troops*3/6;b=total_troops*2/6;c=total_troops*1/6B.ratio=[3,2,1];total_ratio=sum(ratio);a=total_troops*ratio[0]/total_ratio;b=total_troops*ratio[1]/total_ratio;c=total_troops*ratio[2]/total_ratioC.a=total_troops//2;b=total_troops//3;c=total_troops-a-b在correct_answers={"1":"井冈山","2"e:A.user_input=input().split();ifcorrect_answers[user_input[0]]==user_input[1]:print("正确")elsprint("错误")e:B.user_input=input();q_num,ans=user_input.split();ifcorrect_answers[q_num]==ans:print("正确")else:print("错误")C.user_input=input().split();ifuser_input[1]incorrect_answers.values():print("正确")else:print("错误")12.在分析红色根据地粮食储备增长数据时,需要计算数据的平均值,下列Python代码能正确计算列A.sum(grain_data)/len(grain_data)B.average=0;fornumingrain_data:average+=num;average=average/len(grain_data)C.importnumpy;numpy.mean(grain_data)列表为goods_weights,下列代码能正确判断的是A.ifsum(goods_weights)<=max_load:print("可以装载")else:print("无法装载")B.total=0;forwingoods_weights:total+=w;iftotal<=max_load:print("可以装载")else:print("无法装载")C.ifmax(goods_weights)<=max_load:print("可以装载")else:print("无法装载")14.在红色文化传播频次统计中,需要将日期格式从"2026-05-01"转换为"2026年5月1日",下列Python代码能实现该转换的是A.date="2026-05-01";year,month,day=date.split("-");print(f"{year}年{int(month)}月{int(day)}B.date="2026-05-01";parts=date.split("-");print(f"{parts[0]}年{parts[1].strip('0')}月C.importdatetime;date=datetime.datetime.strptime("2026-05-01","%Y-%m-%d");print(date.strftime("%Y年%m月%d日"))A.fire_coef={"低":1,"中":1.5,"高":2};intensity=input();print(fire_coef[intensity])B.defget_fire_coef(intensity):return1return1.5else:return2C.fire_coef=[("低",1),("中",1.5),("高",2)];intensity=input();fork,vinfire_coef:

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论