2、表达式"7//5"的结果是 1

3、列表对象aList的值为[3, 4, 5, 6, 7, 9, 11, 13, 15, 17],那么切片aList[-1:-3:-1]得到的值是 [17, 15]

4、只读方式打开文本文件"fin.txt",正确的函数调用为 open("fin.txt","r")

5、内置函数input()用于从键盘输入数据,返回值类型为 str

6、变量x小于60或大于等于80时,结果为"True",则条件表达式可以表示为__if x<60 or x>=80: print(“True”)__

7、score = 55 if score//10 >= 8: print("A") elif score//10 >= 6: print("B") else : print("C") 以上程序的运行结果是 C

8、x = "v65m8t" y = "" for ch in x: if ch>='0' and ch<='9': ch = '' y = y + ch print(y) 运行以上程序,则输出结果是 __v**mt__

9、将函数ScoreCalc补充完整。函数功能:计算竞赛平均分,若分数不超过3项,直接计算平均分,否则计算除去最高分和最低分后的平均分。 def ScoreCalc(*scores): sum_Scores = sum(scores) count = len(scores) if count<=3: average_Scores = sum_Scores/count else : average_Scores = (sum_Scores-max(scores)-min(scores))/(count-2) return average_Scores print("%4.1f" % ScoreCalc(85,90,91,87,88)) # 测试代码 print("%4.1f" % ScoreCalc(91,95,94))

第1空: (sum_Scores-max(scores)-min(scores))/(count-2)

10、阅读程序,将缺少的代码补充完整: import threading import time def listenMusic(): music = "音乐播放中" while True: music = music +"." print(music) time.sleep(1) thread1 = threading.Thread(target = listenMusic) thread1.start() # 此处代码启动线


原文地址: https://www.cveoy.top/t/topic/gK4q 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录