https://app.dataquest.io/m/316/functions%3A-intermediate/7/more-about-tuples
This was the assignment.
- Use the
open_dataset()
function to open theAppleStore.csv
file, which has a header row. - Do the variable assignment step in a single line of code.
- Assign the header to a variable named
header
. - Assign the rest of the dataset to a variable named
apps_data
.
def open_dataset(file_name='AppleStore.csv', header=True):
opened_file = open(file_name)
from csv import reader
read_file = reader(opened_file)
data = list(read_file)
if header:
return data[1:], data[0]
else:
return data
apps_data, header = open_dataset()
This is the solution code provided by DQ. I don’t understand how this works, when is apps_data being defined?