Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python please. Please use while loops for everything. Also if grades is 0 it needs to return 0. Thanks results should be Complete the

In python please. Please use while loops for everything. Also if grades is 0 it needs to return 0. Thanks

image text in transcribedimage text in transcribed

results should be

image text in transcribed

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: Grades: 83 92 27 Average: 64.25 Max: 92 Min: 27 main.py Load default template... 1 def average(grades): pass 4 def maximum(grades): pass 7 def minimum (grades): pass 10 def print grades (grades): pass 12 13 def get_grades() 14 15 16 def main(): 17 18 19 20 21 pass grades-get_grades () print_grades (grades) print("Average:", average(grades)) print("Max:", maximum(grades)) print("Min:", minimum(grades)) 23 24 if-name 25 26 , main-.. main() Enter program input (optional) 4 8 6 -1 Run program Input (from above) Program output displayed here Enter grade: Enter grade: Enter grade: Enter grade: 4.0 8.0 6.0 Average6.0 Max 8. Min4.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

Students also viewed these Databases questions

Question

3 How the market system answers four fundamental questions.

Answered: 1 week ago

Question

5 The mechanics of the circular flow model.

Answered: 1 week ago

Question

1 The difference between a command system and a market system.

Answered: 1 week ago