Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

WGU Foundations of Programming Python Exam - Topic 4 Question 7 Discussion

In Python, what must follow the in keyword in a for loop?
B) An iterable object
A) A condition
C) A number
D) A variable name

WGU Foundations of Programming Python Exam - Topic 4 Question 7 Discussion

Actual exam question for WGU's Foundations of Programming Python exam
Question #: 7
Topic #: 4
[All Foundations of Programming Python Questions]

In Python, what must follow the in keyword in a for loop?

Show Suggested Answer Hide Answer
Suggested Answer: B

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.


Contribute your Thoughts:

0/2000 characters
Hannah
9 hours ago
I think it has to be something like an iterable object, but I'm not completely sure.
upvoted 0 times
...
Teri
6 days ago
I'm pretty confident it's B) An iterable object. We did a practice question that was exactly like this!
upvoted 0 times
...
Omer
11 days ago
I feel like it could be A) A condition, but that doesn't sound right. I need to double-check my notes.
upvoted 0 times
...
Melvin
16 days ago
I remember we discussed how the in keyword is used with collections, so it must be an iterable.
upvoted 0 times
...
Zack
2 months ago
I think the answer is B) An iterable object, but I'm not completely sure. We practiced something similar in class.
upvoted 0 times
...

Save Cancel