Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems X Special Issue On Database And Expert Systems Applications Lncs 8220

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2013th Edition

3642412203, 978-3642412202

More Books

Students also viewed these Databases questions

Question

6. Does your speech have a clear and logical structure?

Answered: 1 week ago