In Python, what must follow the in keyword in a for loop?
Suggested Answer: B
Get Premium Foundations of Programming (Python) (E010) Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
In a Python for loop, the in keyword is followed by an iterable object, such as a list, string, tuple, dictionary, set, or range() object.
Example:
for name in ['Alice', 'Bob', 'Carol']:
print(name)
Here, ['Alice', 'Bob', 'Carol'] is the iterable object. Python's documentation explains that a for statement iterates over the items of a sequence or other iterable object.
Therefore, the correct answer isB. An iterable object.
22 comments · newest first
CA
Carlota
2 days ago
Wait, really? I thought it could be a number!
LE
Lenita
7 days ago
I thought it could be a condition too, but I guess not.
MI
Miles
12 days ago
Definitely B, no doubt about it.
WI
Willard
17 days ago
It has to be an iterable object!
TH
Theresia
23 days ago
B is the right answer, for sure!
CH
Charlene
28 days ago
Wait, really? I thought it could be a number!
CO
Cory
1 month ago
I thought it could be a condition too, but I guess not.
MA
Margret
1 month ago
Definitely B, no doubt about it.
AR
Arlene
1 month ago
It has to be an iterable object!
MI
Michael
2 months ago
I’m surprised this is even a question, it’s so basic!
GL
Glenn
2 months ago
Definitely not A or C, those don't fit.
DO
Dorinda
2 months ago
Wait, are you sure? I thought it could be a variable name too.
LE
Leota
2 months ago
Totally agree, B is the right answer.
YV
Yvonne
2 months ago
It has to be an iterable object!
SA
Santos
2 months ago
I’m pretty sure it’s not a condition or a number, so that leaves us with an iterable object or a variable name. I need to double-check!
LE
Lemuel
3 months ago
I feel like it could be a variable name too, but that doesn't sound right for this question.
LA
Laurena
3 months ago
I remember practicing a question where we had to identify what comes after "in" in a for loop. I think it was definitely an iterable.
HA
Hannah
3 months ago
I think it has to be something like an iterable object, but I'm not completely sure.
TE
Teri
3 months ago
I'm pretty confident it's B) An iterable object. We did a practice question that was exactly like this!
OM
Omer
3 months ago
I feel like it could be A) A condition, but that doesn't sound right. I need to double-check my notes.
ME
Melvin
4 months ago
I remember we discussed how the in keyword is used with collections, so it must be an iterable.
ZA
Zack
5 months ago
I think the answer is B) An iterable object, but I'm not completely sure. We practiced something similar in class.