Question: this is what i have so far but i keep getting this error (float(row[i]) - float(row[i-6])) ValueError: could not convert string to float: 'Quiz5'

this is what i have so far but i keep getting this error " (float(row[i]) - float(row[i-6])) ValueError: could not convert string to float: 'Quiz5' "

import csv

fName = "/Users/class.csv"

try: file = open(fName, "r") reader = csv.reader(file) for row in reader: for i, v in enumerate(row): if i == 5: (float(row[i]) - float(row[i-6])) print(row)

except IOError: print("The file does not exists:",fName)

this is what i have so far but i keep getting this

structure of csv file:

Name -- quiz 1 -- quiz2 -- quiz3 -- quiz4 -- quiz5 -- quiz6--- quiz7

ashely 12 12 30 50 54 45 30

mike 30 45 80 55 67 65 66

for about 20 columns

The class.csv file contains some in regard to students grades for a specific class. The columns contain the grade the students have received for each assignment. Write a program to read the file, then print the name of the student with the smallest difference in 'Quiz5' and 'Quiz6' grades. Use try/catch to print out "The file does not exists" in case the class.csv file does not exist You can use the csv module to read the csv file. Look at Python documentation for csv.reader() to learn how to use it. Try to right your program in the most compact way possible by using list comprehensions There are 10 bonus points if you use the built-in function min() in order to find the smallest difference

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!