日期:2024-05-12

浙江省温州市十校联合体2023-2024学年高二上学期信息技术期中考试试卷试题详情

某“有机蔬菜种植基地实时监测系统”每隔一定时间采集大棚内的温度数据,如果超出适宜温度范围就会进行降温或升温的调节(适宜温度范围为tmin~tmax(含tmin,tmax)),计算一段时间内超出适宜温度范围的次数,列表变量s存储采集到的温度数据,下列程序正确的是(     )

A、c=O

for i in range(len(s)):

    if tmin <= s[i] <= tmax:

        continue

    c+=1

print("超出适宜温度范围的次数",c)

B、c=0;i=0

while i<len(s):

    if not(tmin<=s[i]<=tmax): 

        c+=1

        i+=1

print("超出适宜温度范围的次数",c)

C、c=O

for i in s:  

    if s[i]<tmin or s[i]>tmax:

        c+=1

print("超出适宜温度范围的次数",c)

D、c=[0]*len(s)

for i in range(len(s)):

    if not(s[i]>=tmin and s[i]<=tmax):

        c[i]=1

print("超出适宜温度范围的次数”,c)

试题所涉知识点

知识点

试题被试卷采用

1