QuestionQuestion

Purpose
The goal of this homework is to get you to use some of the Python skills you've developed in the labs.
Unlike the labs, we're not going to tell you how to do things, just what to do. You should apply the techniques and approaches we've talked about in class, and the things you've learned in the labs to answer the questions that we pose in the homework.
If you can find code on the Internet that solves parts of these problems, then that's fine. Just make sure to cite your sources, and make sure that the code does what you think it does. If you use code that's not part of Python, then you need to include this in your submission, otherwise we won't have it. Also, if you install any additional Python modules, then tell us about this, so that we can install them too.
As with everything in the class, if you have any questions, or anything is unclear, then ask for clarification.
There is ambiguity in this homework; part of our intention is for you to figure out a "reasonable" interpretation. Often, in real world problems, there is this kind of ambiguity, and you have to deal with it.
Remember, we're always happy to answer questions about the lab, and give feedback on that's "reasonable".
Assignment
1. We're going to ask you some questions about these data; you should write Python code to answer these questions. You are not allowed to edit this file. If you do, we will replace it with the original version when we grade your code.
2. What's the average final score in the class? What percentage of students are above average? What about median score? Your code should output information in (exactly) this format:
Average Score: 45.34
Above Average: 23.34%
Median Score: 23.31
Above Median: 65.34%Homework 1

Two decimal places. These example numbers are wrong (obviously).
3. What was the hardest assignment overall? We'll call the hardest assignment the one with the lowest average score. Remember that assignments are worth different amounts of points. Assume that the lowest possible score is zero, and that someone always gets the maximum possible score.
Hardest Assignment: Blah
4. What was the hardest Lab? A lab is something with the word "lab" in the title of the column.
Hardest Lab: Blah
5. If we assume the usual grading scheme
(https://s3.amazonaws.com/screensteps_live/image_assets/assets/000/790/764/original/18963ceb-edd3-46cab16e-efa3755b2b9f.png) , How many students get each grade?
A 12
A- 23
B+ 32
...and so on
6. How many students will complain to us about their grade? A student will compain if they are within 0.5% of getting a higher grade. Students will only complain about their grades if they want them to go up, not if they want them to go down.
23 students will complain about their grade.
7. If we instead want only to assign A, B, C, D, and F, what are the grade cutoffs for each letter grade if we want 10% of students to get an A, 20% to get a B, 30% to get a C, 30% to get a D, and the rest to get an F?
A 95.34
B 54.43
C 34.34
D 12.23Homework 1

1. There are no instructions on how to structure your code here. That's on purpose. You should encapsulate things in functions it makes sense. One function (at least) per question is a reasonable starting place. That way, it'll be easy for us to find the code we want to look at.
2. We will run your code on another CSV file that is similar to, but not the same as, the one we gave you. If you calculate the answers using some other method (in Excel, for example) and just have your code print them out, or hard-code the number of lines in the file, then you will lose points. You should write your code to deal with files that are similar to the example, but with different values in their cells. You can assume that the column headers will be the same in the file that we use, but you cannot assume that the columns will be in the same order.
3. The code that you turn in should print out something that looks very much like the following:
Average Score: 45.34
Above Average: 23.34%
Median Score: 23.31
Above Median: 65.34%
Hardest Assignment: Blah
A 12
A- 23
B+ 32
...
23 students will complain about their grade.
A 95.34
B 54.43
C 34.34
D 12.2

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import csv

'''
PART 1: Load data from CSV file
'''
f = open("grades.csv")
reader = csv.reader(f)
student_data = {}
i = 0
categories = []
for i, row in enumerate(reader):
    if i == 0:
       categories = row
    else:
       student_data[int(row[0])] = [x for x in row]

final_score_index = categories.index("Final Score")
final_scores = [float(student_data[student][final_score_index]) for student in student_data]

'''
PART 2: Average and median score data
'''
average_score = sum(final_scores)/len(final_scores)
print("Average Score: " + "{0:.2f}".format(average_score))
above_average_final_scores = [final_score for final_score in final_scores if final_score > average_score]
above_average = 100.0*len(above_average_final_scores)/len(final_scores)
print("Above A...

By purchasing this solution you'll be able to access the following files:
Solution.py and Grades.csv.

$35.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats