当前位置: 高中信息技术 / 单选题
  • 1. (2023高二上·期中) 某“有机蔬菜种植基地实时监测系统”每隔一定时间采集大棚内的温度数据,如果超出适宜温度范围就会进行降温或升温的调节(适宜温度范围为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)

微信扫码预览、分享更方便