题目
题目

Fal25_CS003C_74229 Ch. 6 Pre-Quiz (Remotely Proctored)

单项选择题

The following code segment is supposed to count the number of times that the number 5 appears in the list values. counter = 0 ____________________ if (element == 5) : counter = counter + 1 What line of code should be placed in the blank in order to achieve this goal?

选项
A.for counter in element :
B.for counter in values :
C.for element in counter :
D.for element in values :
查看解析

查看解析

标准答案
Please login to view
思路分析
The task is to fill the blank with a loop that goes through each item in the list values so that the conditional can check if that item equals 5. Option 1: 'for counter in element :' tries to iterate over 'element', which is just a single value in the loop, and is not defined yet at the point of the ......Login to view full explanation

登录即可查看完整答案

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

更多留学生实用工具

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