D 335 / D335 Objective Assessment (Latest Update 2025 / 2026) Introduction to Programming in Python | Questions and Answers | Grade A | 100% Correct - WGU
Question:
What does reader = csv.reader(file) do?
Answer:
Creates a csv.reader object to read the file as rows of comma-separated values.Each row is returned as a list of strings.
Question:
What does the function strip() do?
Answer:
removes leading and trailing whitespace from each value.
- / 2
Question:
What does the next() function do?
Answer:
Gets row from the CSV file as a list of strings.
with open(file_path, 'r') as file:
reader = csv.reader(file) row1 = [value.strip() for value in next(reader)]
Question:
How to loop through an array by number and skip by 2?
Answer:
for i in range(0, len(row1), 2):
Question:
What is the best way to loop through an unknown amount of inputs?
Answer:
inputs = [int(input()) for _ in range(5)]
- / 2