Question

I need this in Python Please! The college IT department manager no longer wants to use...

I need this in Python Please!

The college IT department manager no longer wants to use spreadsheets to calculate grades. The manager has asked you to create a program that will input the teachers' files and output the students' grades.

In your Python environment, the program must read an input file formatted in CSV format, named input.csv. Each record contains data about a student and their corresponding grades.

The data will look similar to the following:

Student Name, assignment 1, assignment 2, assignment 3, assignment 4

John Adams, 90, 91, 99, 98

Paul Newman, 90, 92, 93, 94

Mary Smith, 95, 96, 99

Be careful to follow the output format exactly, including spacing. The output of your program must look like the following:

Student Assignment Average

John Adams    94.5

Compress your files into a ZIP folder.

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

Here is code:

import csv

import csv


def determine_grade(avg):
avg = int(avg)
if avg >= 90 and avg <= 100:
return 'A'
elif avg >= 80 and avg <= 89:
return 'B'
elif avg >= 70 and avg <= 79:
return 'C'
elif avg >= 60 and avg <= 69:
return 'D'
elif avg <= 60:
return 'F'


for r in (csv.reader(open("Q:\cpp\python\\file\grades.csv", 'r'))):
sum = 0
for i in range(1, len(r)):
sum += int(r[i])
avg = sum / (len(r) -1)
letter = determine_grade(avg)
print(r[0] ,"-", avg ," - ", letter)

grades.csv:

John Adams, 90, 91, 99, 98
Paul Newman, 90, 92, 93, 94
Mary Smith, 95, 96, 99

Output:

Add a comment
Know the answer?
Add Answer to:
I need this in Python Please! The college IT department manager no longer wants to use...
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
  • The college IT department manager no longer wants to use spreadsheets to calculate grades. The manager...

    The college IT department manager no longer wants to use spreadsheets to calculate grades. The manager has asked you to create a program that will input the teachers' files and output the students' grades. Write a Ruby program named format file.rb, which can be run by typing ruby widgets.rb. In your Ruby environment, the program must read an input file formatted in CSV format, named input.csv. Each record contains data about a student and their corresponding grades. The data will...

  • Wk 4 - Write a Ruby Program (due Mon] Assignment Content The college IT department manager...

    Wk 4 - Write a Ruby Program (due Mon] Assignment Content The college IT department manager no longer wants to use spreadsheets to calculate grades. Instead, the manager has asked you to create a program that will input the teachers' files and output the students' grades. Write a Ruby program named format file.rb, which can be run by typing ruby widgets.rb. In your Ruby environment, the program must read an input file formatted in CSV format, named input.csv. Each record...

  • (IN PYTHON) You are to develop a Python program that will read the file Grades-1.txt that...

    (IN PYTHON) You are to develop a Python program that will read the file Grades-1.txt that you have been provided on Canvas. That file has a name and 3 grades on each line. You are to ask the user for the name of the file and how many grades there are per line. In this case, it is 3 but your program should work if the files was changed to have more or fewer grades per line. The name and...

  • [15 marks] Suppose that students enrolled in one course are required to take four tests, and...

    [15 marks] Suppose that students enrolled in one course are required to take four tests, and each student’s final grade for this course is the average of his/her grades of these four tests. This question asks you to write a program that can be used to compute the lowest final grade, highest final grade and the average final grade. General Requirements: Use a5q1.c as the name of your C source code file. We will use the following command on bluenose...

  • given below are the project description and their Html and css files i need javascript according to the project and other files!

    HTML------------------------------------------------------CSS---------------------------------------------------WEB230 - JavaScript 1 Assignment 7 - FormsSome of these tasks would be better done in HTML or CSS but do them in JavaScript to practice whatwe have learned.1. Select the form element and save it in a variable. From here we can access all of the form fields.2. When the page loads do the following:add the password value "monkey"select the favourite city "New York"clear the textarea3. Add an event handler to the "name" field to change the background color...

  • Your mission in this programming assignment is to create a Python program that will take an...

    Your mission in this programming assignment is to create a Python program that will take an input file, determine if the contents of the file contain email addresses and/or phone numbers, create an output file with any found email addresses and phone numbers, and then create an archive with the output file as its contents.   Tasks Your program is to accomplish the following: ‐ Welcome the user to the program ‐ Prompt for and get an input filename, a .txt...

  • Python Help Please! This is a problem that I have been stuck on.I am only suppose...

    Python Help Please! This is a problem that I have been stuck on.I am only suppose to use the basic python coding principles, including for loops, if statements, elif statements, lists, counters, functions, nested statements, .read, .write, while, local variables or global variables, etc. Thank you! I am using python 3.4.1. ***( The bottom photo is a continuation of the first one)**** Problem statement For this program, you are to design and implement text search engine, similar to the one...

  • I need help with this code, I'm stuck on it, please remember step 4, I'm very...

    I need help with this code, I'm stuck on it, please remember step 4, I'm very much stuck on that part. It says something about putting how many times it appears Assignment #1: Sorting with Binary Search Tree Through this programming assignment, the students will learn to do the following: Know how to process command line arguments. 1 Perform basic file I/O. 2. Use structs, pointers, and strings. Use dynamic memory. 3. 4. This assignment asks you to sort the...

  • Hi Guys, Need help on python questions Question 3. At the Singapore Zoo, each adult ticket...

    Hi Guys, Need help on python questions Question 3. At the Singapore Zoo, each adult ticket costs $ 39, each child (>= 3 years old, <= 12 years old) ticket costs $26.50 and each young child (< 3 years old) ticket is free. Write a program to ask the user to enter the number of tickets for each type and then display the ticket information. Your code must work exactly like the following example (the text in bold indicates the...

  • Please help. I need a very simple code. For a CS 1 class. Write a program...

    Please help. I need a very simple code. For a CS 1 class. Write a program in Java and run it in BlueJ according to the following specifications: The program reads a text file with student records (first name, last name and grade). Then it prompts the user to enter a command, executes the command and loops. The commands are the following: "printall" - prints all student records (first name, last name, grade). "firstname name" - prints all students with...

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