题目
题目
单项选择题

Question17 What does the code below do? def my_function(n): total = 0 while True: total += 5  if total >= n: break return total Select one alternative: It generates an infinite loop. It returns the sum of all numbers from 1 to n. It always returns 3. It returns the smallest multiple of 5 that is greater than or equal to n. ResetMaximum marks: 2 Flag question undefined

选项
A.It generates an infinite loop.
B.It returns the sum of all numbers from 1 to n.
C.It always returns 3.
D.It returns the smallest multiple of 5 that is greater than or equal to n.
查看解析

查看解析

标准答案
Please login to view
思路分析
Question: What does the code below do? def my_function(n): total = 0 while True: total += 5  if total >= n: break return total Options: 1) It generates an infinite loop. 2) It returns the sum of all numbers from 1 to n. 3) It always returns 3. 4) It returns the smallest multiple of ......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!