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

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
Zack
16 days 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