Question
This is the code I have submitted, I think my issues is with using lar = ....?? def average(grades): sum = 0 avg = 0
This is the code I have submitted, I think my issues is with using lar = ....??
def average(grades): sum = 0 avg = 0 i = 0 if len(grades)
def maximum(grades): i = 0 lar = grades[0] if len(grades) lar: lar = grades[i] i = i + 1 return lar
def minimum(grades): i = 0 small = grades[0] if len(grades)
def print_grades(grades): i = 0 while i
def get_grades(): grades = [] grade = 0 while int(grade) >= 0: grade = input('Enter grade: ') if int(grade) >= 0: grades.append(float(grade)) return grades
def main(): grades = get_grades()
print_grades(grades) print("Average:", average(grades)) print("Max:", maximum(grades)) print("Min:", minimum(grades))
if __name__ == '__main__': main()
Test feedback maximum ([]) incorrectly implemented Minimum Test feedback minimum ([]) incorrectly implemented In this assignment you will process some grades for your professor so you can learn how to write loops. You may not use the built-in Python functions to do these operations. Each function should use a while loop to implement the equivalent functionality. Complete the following functions defined in the code below. .get grades0 should iterate with a while loop to put all positive values into a list called grades until encountering a negative value. average0 should return the average of all the values in grades list. If grades is empty, average should be zero. maximum0 should return the maximum grade in grades list. If grades is empty, maximum should be zero. minimum0 should return the minimum grade in grades list. If grades is empty, minimum should be zero. print grades0 should print the grades each on a separate line. It should not print in list format Example main output: Enter grade: Enter grade: Enter grade: Enter grade: Enter grade: 55.0 83.0 92.0 27.0 Average: 64.25 Max: 92.0 Min: 27.0 Note: DO NOT USE FOR LOOPS OR BUILT IN LIST FUNCTIONS (except len0 and append))Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started