题目
题目

ACCN-3290-02Sp25 Week 1 Quiz

单项选择题

Which of the following code snippets correctly prints the numbers from 1 to 10, except for those divisible by 3?

选项
A.for i in range(1, 11):     if i % 3 != 0:         print(i)     i += 1
B.for i in range(1, 11):     if i % 3 == 0:         break     else:         print(i)
C.for i in range(1, 11):     if i % 3 == 0:         print(i)
D.for i in range(1, 11):     if i % 3 != 0:         print(i)
查看解析

查看解析

标准答案
Please login to view
思路分析
We’re evaluating code snippets to print numbers 1 through 10 while skipping those divisible by 3. Option 1: for i in range(1, 11): if i % 3 != 0: print(i) This checks each i from 1 to 10 and prints i only when i is not a multiple of 3. Therefore it prints 1......Login to view full explanation

登录即可查看完整答案

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

更多留学生实用工具

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