OnlinePython

Writing Files Exercise

Question 1 of 4

When writing a list of data to a CSV file, which approach correctly formats the output?

data = [
    ['Name', 'Age', 'City'],
    ['Alice', 28, 'New York'],
    ['Bob', 35, 'Los Angeles']
]
# Write to CSV file