218k views
5 votes
1. Grade data is:

79,99,73,49,67,62,52,99,57,58,67,88,71,69,41,74,53,90,63,66,92,54,61,59,48,71,83,89,99,69,66,40,48,41,99,68,52,78,77, 71,40,65,77,87,96,44,54,60,89,72
Write Python to find the minimum and the maximum grade in the set of grades given. Once again, please do not use built-in functions. Instead, use your knowledge of lists and list indices, loops and if-elif-else blocks to find and display these two values. Use Excel to verify your results.
2. You are a kind-hearted instructor that wants to raise the average grade for your class. Write Python code to determine the constant deltaGrade that must be added to each student’s grade for the class average to be exactly 75.0. You may allow some student grades to exceed 100.0 for this exercise.

1 Answer

4 votes

Answer:

1.)

import math

def min_max(lst):

minimum = math.inf

maximum = -math.inf

for x in lst:

if minimum > x:

minimum = x

elif maximum < x:

maximum = x

return minimum, maximum

2.)

def deltaGrade(lst):

sm = 0 #sm is sum

for x in lst:

sm += x

mean = sm/len(lst)

deltaG = 75 - mean

return deltaG

User Foo Bar User
by
5.0k points