I have another question.
can I use function and mixed a number of operation on one csv file?
for the same code:
can I use function and mixed a number of operation on one csv file?
for the same code:
import csv from statistics import mean import itertools from collections import OrderedDict def calculate_averages(input_file_name, output_file_name): with open ('grades.csv', 'r') as input_file_name: reader=csv.reader(input_file_name) data = [] for row in reader: l2 = [] name = row[0] grades=[int(num) for num in row[1:]] l2.append(name) l2.append(float(mean(grades))) data.append(l2) with open('grades.csv', 'w', newline='') as output_file_name: writer = csv.writer(output_file_name) writer.writerows(data)and after that i am going to use another function...