← Back to Files
Question 423
Rows From A DictWriter
Rows From A DictWriter
The write step uses csv.DictWriter with the field names name and score to write a header and two rows to results.csv (the second row comes from input). Open the file for reading, build a csv.DictReader over it, loop over the rows and print <name> scored <score> for each one using row["name"] and row["score"]. Input: two lines, a name then a score, no prompt. Import only csv.
Expected Output:
Lee scored 88 Maya scored 92
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
FilesCSV
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.