Question

Can someone help me with this problem? I have been struggling with Python 3 for a while now and not even the professor would help me solve this problem. I have to import a file called grades.csv and use error handling for a mid-semester report. please help me, I have been having trouble understand import csv. You don't have to check for errors or anything like that. I just have to display the mid-semester report

This project will have you using error handling and file handling to display mid semester report with percentage of student w

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python csv module provides 2 main different reading functions : reader() and DictrRader().

I recommend that you use DictReader() as it will give you dictionaries which have column names as keys.

Code for loading data :

import csv

file_name = "Students.csv"

csv_in = open(file_name, 'r', newline='')

data = csv.DictReader(csv_in, delimiter=',')  #read data from specified file

Once the data is loaded, you can iterate through all rows simply by using for rows in data as shown below:

[17] DEM! import csv file_name = Students.csv csv_in = open(file_name, r, newline=)|| data = csv.DictReader(csv_in, deli

And you can access particular columns using them as dictionary keys, For example if i want to calculate total score of exam1 & exam2 for all students, i can do:

for row in data: print (row) row[exam_total] = float(row[exam1])+float(row[exam2]) print(Total of exams: ,row[exam_t

This way, you can complete all your required calculations. I hope this solves your query.

(*Note: Please up-vote if you find it helpful. If any doubt, please let me know in the comments)

Add a comment
Know the answer?
Add Answer to:
Can someone help me with this problem? I have been struggling with Python 3 for a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Many classes calculate a final grade by using a weighted scoring system. For example, “Assignments” might...

    Many classes calculate a final grade by using a weighted scoring system. For example, “Assignments” might be worth 40% of your final grade. To calculate the grade for the Assignments category, the teacher takes the percentage earned on the assignments and multiplies it by the weight. So if the student earned a 90% total on the Assignments, the teacher would take 90% x 40, which means the student earned a 36 percent on the Assignments section. The teacher then calculates...

  • Please help me I need someone to help me with this program in C# please Write...

    Please help me I need someone to help me with this program in C# please Write a program named Admission for a college’s admissions office. The user enters a numeric high school grade point average (for example, 3.2) and an admission test score. Display the message Accept if the student meets either of the following requirements: A grade point average of 3.0 or higher, and an admission test score of at least 60 A grade point average of less than...

  • have to create five different functions above and call it in the main fucntion. Project Exam...

    have to create five different functions above and call it in the main fucntion. Project Exam Statistics A CIS 22A class has two midterm exams with a score between 0 and 100 each. Fractional scores, such as 88.3 are not allowed. The students' ids and midterm exam scores are stored in a text file as shown below // id exam1 exam2 DH232 89 92 Write a program that reads data from an input file named exams.txt, calculates the average of...

  • Hi - Some help create a short program that uses a pandas DataFrame (solution MUST use...

    Hi - Some help create a short program that uses a pandas DataFrame (solution MUST use a DataFrame) to do the following. Please include comments /notes to explain what is going on. Solution does not need to define functions two csv files are included (grades01.csv): raw marks of students taking an examination; and a further csv file (rubric01.csv) summarizing the maximum mark available for each of the six questions. Structure of grades01: Student ID,Question 1,Question 2,Question 3,Question 4,Question 5,Question 6...

  • Principles of Computer Science

    Question First, you need to design, code in Java, test and document a base class, Student. The Student class will have the following information, and all of these should be defined as Private: A. Title of the student (eg Mr, Miss, Ms, Mrs etc) B. A first name (given name) C. A last name (family name/surname) D. Student number (ID) – an integer number (of type long) E. A date of birth (in day/month/year format – three ints) - (Do NOT use the Date class from...

  • please help asap in c++, you dont have to do everything but at least give me...

    please help asap in c++, you dont have to do everything but at least give me a starting idea of how this should look like Write a class Assignment that has private attributes for Name, Possible Points and Earned Points Write a class Student that has private attributes for name and a vector of assignments. The constructor method should require a name. Add a method for get total score that returns the total number of points earned divided by the...

  • python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gr...

    python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gradebook software to keep track of your grades. Some instructors like to calculate grades based on what is sometimes called a “total points” system. This is the simplest way to calculate grades. A student’s grade is the sum of the points earned on all assignments divided by the sum of the points available...

  • Java program Program: Grade Stats In this program you will create a utility to calculate and...

    Java program Program: Grade Stats In this program you will create a utility to calculate and display various statistics about the grades of a class. In particular, you will read a CSV file (comma separated value) that stores the grades for a class, and then print out various statistics, either for the whole class, individual assignments, or individual students Things you will learn Robustly parsing simple text files Defining your own objects and using them in a program Handling multiple...

  • you need to use javafx for following problem these instructions is for JavaFX program so you...

    you need to use javafx for following problem these instructions is for JavaFX program so you need to follow the instructions and according to images you have design the GUI Write a program to design the following interface and use event handling and File 10 to perform the given operation. Make sure you have a background image and different color for labels and buttons for this interface. Input Information Course Quiz Grade Assignment Grade Fal Grade Submit View Grade Info...

  • I need help in Python. This is a two step problem So I have the code...

    I need help in Python. This is a two step problem So I have the code down, but I am missing some requirements that I am stuck on. Also, I need help verifying the problem is correct.:) 7. Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 500. The application should let the user specify how many random numbers the file...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT