Hey there! Also new to Python. Went through your code and I’m curious why you chose to do csv.DictReader in both the averagr age and smoker vs non smoker functions. Is there a performance benefit to that vs. loading the csv data once to lists or a dictionary then using that for functions?
Yes you can do that as well BUT it is a bigger load in the beginning as you need to keep the file open whilst you are using the csv.DictReader. Which mean that you need to do all the calculations upfront. as I have programmed it I can use the function I need (as I don’t always need to use both functions).I will expand the code, when I have the time to implement more functions as I want to to create a graph of the distribution of smokers and non smoker per region and see if an region is paying more or less based on smoking
Hope that helps
Cool, thanks for clarifying!