Exercise - Processing CSV files using a dictionary of lists

I couldn’t find anything on the exercise for lecture 3 for processing csv files using a dictionary of lists. I found it pretty difficult but finally cracked it so thought I’d post my comment in case anyone else is trying this and needs some hints:

# Step 1 - Download files
# Import OS and urllib request module to be used later
# Create folder called data2 in directory
# retrieve files from url, and add them to data2 folder with names
# Step 2 - Create function to read data and return dictionary
# Take a csv file as input
# Open the file and convert the data into a list of lines
# Take the first line and format it to create a list of headers
# Take each column of data and put it into a list
# First create an empty list for the columns
# Next iterate through the columns based on the number of headers
# Create an empty list for each column of data
# Now iterate through each line / row of data (excluding the header line)
# Format the line of data
# Check the line for missing items and convert them to 0.0
# Add the data point from the row and respective column to the column list
# Add the full list of column of data to the columns list
# Create an empty dictionary
# Pair up each column of data to the respective headers
# Add the key (header) and value (column of data) to the dictionary
# Return the dictionary as output
# Step 3 - Create function to compute EMIs
# Take a dictionary (e.g. from Step 2) as an input
# import math module as required later for rounding
# Create an empty list
# Iterate through each loan
# Assign variables for each item in the loan
# Calculate emi
# Round emi
# append each emi to the list of emis
# Assign the list of the emis to the key and add to the dictionary
# Return the updated dictionary with the emis added
# Step 4 - Create a function to write a csv file with the loans and EMIs
# Take the dictionary as an input, and define the output file location and name
# Create a new file using the input provided
# Collect the headers from the keys
# Join the headers together into csv format and write to the file
# Iterate through the loans based on the total number of loans
# Create a list for each loan and covert the floats back into strings
# Join the values together into csv format and write to the file