大学网课搜题引擎
首页
爱课程(中国大学MOOC)
Python程序设计
第三章 循环程序与应用
题目详情
简答题
对于大于2的正整数n,如果表达式 0 not in [n%d for d in range(2, n)]的值为True,则说明n是素数
A、正确
B、错误
查看答案与解析
简答题
表达式len(range(1, 10))的值为______
简答题
Python可以使用For作为变量名 A、正确 B、错误
简答题
对于下列程序:total = 0for i in range(5): total += iprint(i) for循环结束后,循环变量i不存在,导致程序错误 A、正确 B、错误
简答题
在循环语句中,______语句的作用是跳过本次循环的后续语句,进入下一次循环
简答题
表达式sum(range(1, 10, 2))的值为______ A、1 B、25 C、3 D、35
简答题
下列程序的输出结果是2m = 0x = 1while x A、正确 B、错误
简答题
在循环语句中,______语句的作用是提前结束当前层次的循环
简答题
以下程序输出"Welcome to Python" ()次count = 0while count A、0 B、8 C、9 D、10
简答题
以下()程序输出"Welcome to Python"10次。 I: for count in range(1, 10): print("Welcome to Python") II: for count in range(0, 10): print("Welcome to Python") III: for count in range(1, 11): print("Welcome to Python") IV: for count in range(1, 12): print("Welcome to Python") A、II, IV B、I, II, III C、I, III D、II, III
简答题
表达式list(range(1, 10, 3)) == [1, 4, 7]的值为______
简答题
以下程序的输出结果是() number = 6while number > 0: number -= 3 print(number, end = ' ') A、6 3 0 B、6 3 C、3 0 D、3 0 -3
简答题
以下()程序正确计算了"1/2 + 2/3 + 3/4 + ... + 99/100" 的值 I: total = 0for i in range(1, 99): total += i / (i+1)print("Total is", total) II: total = 0for i in range(1, 100): total += i / (i+1)print("Total is", total) III: total = 0for i in range(0, 99): total += i / (i+1)print("Total is", total) IV: total = 0for i in range(1, 101): total += i / (i+1)print("Total is", total) A、II, III, IV B、I, II, III, IV C、II D、III, IV
简答题
下列while循环执行的次数为6次 k=10while k>=5: k = k-1 A、正确 B、错误
简答题
下列语句执行结果是什么? a = 1for i in range(5): if i == 2: break a += 1 else: a += 1print(a) A、1 B、2 C、3 D、6
简答题
表达式sum(range(10))的值为______ A、45 B、55 C、11 D、46
简答题
下列Python程序的运行结果是() x = 0y = Trueprint(x>y and 'A' A、True B、False C、true D、false
简答题
在编写多层循环时,为了提高运行效率,应尽量减少内循环中不必要的计算 A、正确 B、错误
简答题
表达式range(10)[-1]的值为______
简答题
下列程序的输出结果是14 count = 0for x in range(2, 5): count = count + xprint(count) A、正确 B、错误
简答题
表达式0 or not 1 and 2的值为True A、正确 B、错误
Python程序设计
章节列表
第一章 绪论
25
第二章 顺序和分支程序应用
23
第三章 循环程序与应用
24