Question

In: Computer Science

Create a grade report. The grades will be stored as a list of tuples: [ (grade_percentile_1...

Create a grade report.

The grades will be stored as a list of tuples:

[ (grade_percentile_1 , grade_letter_1) , (grade_percentile_2 , grade_letter_2) , .... ]

Create each grade percentile using a random generator to uniformly choose a percent between 50% and

100%. Assign the letter grade based on the chosen percentile using the table below.

Numeric Average Letter Grade Numeric Average Letter Grade
93 - 100 A 90 - 92.99 A-
87 - 89.99 B+ 83 - 86.99 B
80 - 82.99 B- 77 - 79.99 C+
73 - 76.99 C 70 - 72.99 C-
67 - 69.99 D+ 63 - 66.99 D
60 - 62.99 D- Below 60 F

Create 35 random grades and store them as a list of 35 tuples. You decide on the class name. Then print all 35 grades to the screen, along with summary information (total number of grades, minimum grade, maximum grade, and average grade). Show all grades and the average with exactly 2 decimal places.

Submit your program script called grades.py. Use functions as appropriate for optimal abstraction and encapsulation.

Here is an example of how the grade report could appear:

Grades for Applied Neural Networks    Letter Grade

    Numeric Grade (%)

86.75 B+

76.62 C+

85.50 B

74.00 C

92.35 A-

97.72 A

55.35   F

72.67 C

65.87 D

94.87 A

97.53    A

63.42 D

82.57 B

72.43 C-

87.65 B+

68.56 D+

59.34   F

62.87   D

92.62 A

Total Grades: 19

Minimum Grade: 55.35

Maximum Grade: 97.72

Average Grade: 78.35

Solutions

Expert Solution

Hi

Program:

import random

def assign_letter_grade(score):

    if score <= 100 and score >=93: return "A"

    elif score <= 92.99 and score >=90: return "A-"

    elif score <= 89.99 and score >= 87: return "B+"

    elif score <= 86.99 and score >=83: return "B"

    elif score <= 82.99 and score >=80: return "B-"

    elif score <= 79.99 and score >=77: return "C+"

    elif score <= 76.99 and score >=73: return "C"

    elif score <= 72.99 and score >=70: return "C-"

    elif score <= 69.99 and score >=67: return "D+"

    elif score <= 66.99 and score >=63: return "D"

    elif score <= 62.99 and score >=60: return "D-"

    else : return "F"

List = []

y=0

max=0

min=0

total=0

for x in range(35):

    score = random.uniform(50,100)

    if(score > max):

        max=score

    if(x == 0):

        min=score

    elif(score < min):

        min=score

    total=total+score

    t1 = (score, assign_letter_grade(score))

    List.insert(x, t1)

    y=y+1

print("Grades for Applied Neural Networks")

print("Numeric Grade (%)    Letter Grade")

for k in List:

    #print(k)

    print("%.2f                  %s" % (k[0], k[1]))

print("Toal Grades: %d" % y)

print("Minimum Grade: %.2f" % min)

print("Maximum Grade: %.2f" % max)

avg = total/y

print("Average Grade: %.2f" % avg)


Screenshot:


Related Solutions

JAVASCRIPT: - Please create an object (grade) with 10 names and 10 grades. - Create a...
JAVASCRIPT: - Please create an object (grade) with 10 names and 10 grades. - Create a method (inputGrade) that can put a name and a grade to the grade object. - Create another method (showAlltheGrades) to show all the grade in that object. - Create the third method (MaxGrade) that can display the maximum grade and the student name. - Using “prompt” and inputGrade method input 10 student names and their grades. - Display all the grades and names by...
JAVASCRIPT: - Please create an object (grade) with 10 names and 10 grades. - Create a...
JAVASCRIPT: - Please create an object (grade) with 10 names and 10 grades. - Create a method (inputGrade) that can put a name and a grade to the grade object. - Create another method (showAlltheGrades) to show all the grade in that object. - Create the third method (MaxGrade) that can display the maximum grade and the student name. - Using “prompt” and inputGrade method input 10 student names and their grades. - Display all the grades and names by...
JAVASCRIPT: - Please create an object (grade) with 10 names and 10 grades. - Create a...
JAVASCRIPT: - Please create an object (grade) with 10 names and 10 grades. - Create a method (inputGrade) that can put a name and a grade to the grade object. - Create another method (showAlltheGrades) to show all the grade in that object. - Create the third method (MaxGrade) that can display the maximum grade and the student name. - Using “prompt” and inputGrade method input 10 student names and their grades. - Display all the grades and names by...
Task 4:         Tuples Explain what is the difference between list, string and tuple? Create a list...
Task 4:         Tuples Explain what is the difference between list, string and tuple? Create a list example and check whether you could change the item within the list. Create a string example and check whether you could change the item within the string. Create a tuple example and check whether you could change the item within the tuple.
Discover classes for generating a student report card that lists all classes, grades, and the grade...
Discover classes for generating a student report card that lists all classes, grades, and the grade point average for a semester. Create a UML diagram with constructors and methods. Implement the code including Javadoc comments.
Write a program that translates a letter grade into a number grade. Letter grades are A,...
Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D, and F, possibly followed by + or -. Their numeric values are 4, 3, 2, 1 and 0. There is no F+ or F-. A “+” increases the numeric value by 0.3, a “–“ decreases it by 0.3. However, an A+ has value 4.0.4 pts Enter a Letter grade: B- The numeric value is 2.7 Your code with comments A screenshot...
Write a function that accepts a dictionary and produces a sorted list of tuples The dictionary...
Write a function that accepts a dictionary and produces a sorted list of tuples The dictionary looks like this: {‘US’: [{'Chicago, IL': ('2/1/2020 19:43', 2, 0, 0)}, {'San Benito, CA': ('2/3/2020 3:53', 2, 0, 0)}, {'Santa Clara, CA': ('2/3/2020 0:43', 2, 0, 0)}, {'Boston, MA': ('2/1/2020 19:43', 1, 0, 0)}, {'Los Angeles, CA': ('2/1/2020 19:53', 1, 0, 0)}, {'Orange, CA': ('2/1/2020 19:53', 1, 0, 0)}, {'Seattle, WA': ('2/1/2020 19:43', 1, 0, 0)}, {'Tempe, AZ': ('2/1/2020 19:43', 1, 0, 0)}], 'Australia'...
Assume that you have an array of 100 elements representing the grades students are stored in...
Assume that you have an array of 100 elements representing the grades students are stored in memory. Suppose the grades are in IEEE single precision format. Write a MIPS program to compute the average of the students grades and store the result in register $f0. Assume the array base address is stored in register $s0 and a floating point value of 100 is stored in memory with it address given in register $s2.
Write a method that, given an array of grades stored as double values, computes and return...
Write a method that, given an array of grades stored as double values, computes and return their mean.    Write another method that will return an array of the mean grade obtained by an arbitrary number of student.    This method will take a 2-dimensional array of double values in which each row corresponds to the grade vector    for a different student. You can compute the mean for each row as you did before...    Once you are done,...
Create a C++ program that will accept any number of grades for an exam. The grades...
Create a C++ program that will accept any number of grades for an exam. The grades will be input as 4 for an A, 3 for a B, 2 for a C, 1 for a D, and 0 for an F. After all grades have been entered, allow the user to enter -1 to exit. Output the number of grades in each category. Using arrays.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT