Question: python Blart and finish values must be integers Problem 3: sum_column(file_name, column) - returns total for column Write a function that takes 2 parameters: 1.
Blart and finish values must be integers Problem 3: sum_column(file_name, column) - returns total for column Write a function that takes 2 parameters: 1. file_name - the name of a data file to read 2. column - the index to which column in the data file to sum The function attempts to read the file and sum up the specified column. For example, if the function was called as sum_column("data3.txt", 2) And the contents of data3.txt was 10 23 44 12 0912 The function would return 66 (the sum of 44 and 12, the numbers found in column 2 of the file. More examples >>> sum_column('columns.txt', 0) 151.0 >>> sum_column('columns.txt', 2) 182.0 >>> sum_column ('columns.txt', 4) Column out of range 0 >>> sum_column('xcolumns.txt', 4)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
