Write Lists as CSV Records (Exercise)
00:00 Welcome to the second section of this Python Basics Exercises course, which will test your ability to work with comma-separated values files in Python. CSV files are more specific text files suitable for storing tabular data.
00:15
You’ll start this exercise from the following Python code snippet. It defines a variable named numbers
, which references a nested list. Notice that each element of the outer list is a list itself, which contains the subsequent integer.
00:31
In that sense, numbers
is a two-dimensional table of integers arranged as rows or columns, depending on how you look at them.
00:40
In algebra, such tables are quite popular and known as matrices. Now your goal is to take each row of numbers stored in that variable and write it to a CSV file called numbers.csv
, which should be located in your home directory.
Become a Member to join the conversation.