I want to build a function that calculates the difference between estimated insurance costs and actual insurance costs. I’m not quite sure how to get the data into the function and then store it to a list:
1 - make sure that all variables are declared
2- cost_diff should be a string inside the print statement since python allow string concatenation only with string type, you can do this by type casting (str(cost_diff)).
By and large functions are designed to return something. On occasion they’ll serve the purpose of printing information and there’s nothing wrong with that, but in this example by returning the value of interest you can append them to a list and you can still print them by printing the call instead which makes your function much more useful.