Program is in Python and needs to look EXACTLY like the example attached. Thank you!   As part of this assignment, the program that you will be writing will store current grades in a dictionary using course codes as keys and with values consisting of percent grades in lists. The main functions of this program are to print a student's gradebook, to drop the lowest grade in each course, print the student's gradebook again, drop the course with lowest average, and finally printing the student's gradebook again.  This program requires a main function and a custom value-returning function. In the main function, code these basic steps in this sequence (intermediate steps may be missing): start with an empty dictionary that represents a gradebook and then use a while loop to allow the input of course codes from the keyboard. End the while loop when the user presses enter without entering data. within the while loop: for each course entered, use a list comprehension to generate five random integers in the range of 70 through 100. These random integers in a list represent the grades for the course.  after entering the courses, call a custom function passing to it the dictionary now populated with course information and associated grade information In the custom function: first print the underlined headings for Course, Average Grade and Grades columns. See the example output for proper formatting (hint: use an 8-character width, left justified for "Course"; use 5-character width, centered, for "Avg"; and use 25-character width for "Grades") use a for loop and the items method to extract the course and grade data from gradebook. within the for loop: use a built-in method to sort the list of grades use another for loop to sum all grades for the course calculate the average for the course using the sum of all grades and a built-in function to determine the number of grades in the list of grades use an if statement to determine the course with the lowest average (hint: this may require initializing the variable used to store the lowest average to the highest possible grade value prior to the for loop).  print the course and its average. Use format identifiers to allow for printing of a left-justified course with a width of 8 and for an average with a width of 4 including 1 decimal place. use another for loop to print all grades in the grades list for the course. Use a format identifier to allow for printing of a right-justified grade with a width of 4 followed by a percent sign. calculate and print the term average using the previously calculated sum of all grades and built-in functions to determine the number items in the gradebook dictionary and grade list. Use a format identifier to allow for printing of a grade with a width of 4 including one decimal position followed by a percent sign. return the course with the lowest average Back in main function: print a message indicating that the lowest grades are being dropped.  See the example output for proper formatting. use a for loop and the values method of the gradebook to extract the grades list for each course within the for loop use a built-in function to determine the lowest grade from the grades list for a particular course use a built-in function to remove the lowest grade print a message indicating that courses and grades are being printed after the lowest grades have been dropped.  See the example output for proper formatting. call the custom function again passing to it the updated dictionary now populated with course information and associated grade information with the lowest grades for each course dropped drop the lowest course, which is returned by the custom function, from the gradebook. Use a built-in function to drop the course. print a message indicating that courses and grades are being printed after the lowest course has been dropped.  See the example output for proper formatting. call the custom function again passing to it the updated dictionary now populated with course information and associated grade information with the lowest course dropped For your testing purposes, enter at least five courses although any amount should be allowed to be entered Printed output and messages should be formatted as in the example outputs.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Can you please answer the following? Program is in Python and needs to look EXACTLY like the example attached. Thank you!

 

As part of this assignment, the program that you will be writing will store current grades in a dictionary using course codes as keys and with values consisting of percent grades in lists. The main functions of this program are to print a student's gradebook, to drop the lowest grade in each course, print the student's gradebook again, drop the course with lowest average, and finally printing the student's gradebook again. 

This program requires a main function and a custom value-returning function.

In the main function, code these basic steps in this sequence (intermediate steps may be missing):

  • start with an empty dictionary that represents a gradebook and then use a while loop to allow the input of course codes from the keyboard. End the while loop when the user presses enter without entering data.
  • within the while loop:
    • for each course entered, use a list comprehension to generate five random integers in the range of 70 through 100. These random integers in a list represent the grades for the course. 
  • after entering the courses, call a custom function passing to it the dictionary now populated with course information and associated grade information

In the custom function:

  • first print the underlined headings for Course, Average Grade and Grades columns. See the example output for proper formatting (hint: use an 8-character width, left justified for "Course"; use 5-character width, centered, for "Avg"; and use 25-character width for "Grades")
  • use a for loop and the items method to extract the course and grade data from gradebook.
  • within the for loop:
    • use a built-in method to sort the list of grades
    • use another for loop to sum all grades for the course
    • calculate the average for the course using the sum of all grades and a built-in function to determine the number of grades in the list of grades
    • use an if statement to determine the course with the lowest average (hint: this may require initializing the variable used to store the lowest average to the highest possible grade value prior to the for loop). 
    • print the course and its average. Use format identifiers to allow for printing of a left-justified course with a width of 8 and for an average with a width of 4 including 1 decimal place.
    • use another for loop to print all grades in the grades list for the course. Use a format identifier to allow for printing of a right-justified grade with a width of 4 followed by a percent sign.
  • calculate and print the term average using the previously calculated sum of all grades and built-in functions to determine the number items in the gradebook dictionary and grade list. Use a format identifier to allow for printing of a grade with a width of 4 including one decimal position followed by a percent sign.
  • return the course with the lowest average

Back in main function:

  • print a message indicating that the lowest grades are being dropped.  See the example output for proper formatting.
  • use a for loop and the values method of the gradebook to extract the grades list for each course
  • within the for loop
    • use a built-in function to determine the lowest grade from the grades list for a particular course
    • use a built-in function to remove the lowest grade
  • print a message indicating that courses and grades are being printed after the lowest grades have been dropped.  See the example output for proper formatting.
  • call the custom function again passing to it the updated dictionary now populated with course information and associated grade information with the lowest grades for each course dropped
  • drop the lowest course, which is returned by the custom function, from the gradebook. Use a built-in function to drop the course.
  • print a message indicating that courses and grades are being printed after the lowest course has been dropped.  See the example output for proper formatting.
  • call the custom function again passing to it the updated dictionary now populated with course information and associated grade information with the lowest course dropped
  • For your testing purposes, enter at least five courses although any amount should be allowed to be entered
  • Printed output and messages should be formatted as in the example outputs.
Enter a course name ==> COP1000
Enter another course name or press enter to end ==> MAT1000
Enter another course name or press enter to end ==> PHY1000
Enter another course name or press enter to end ==> ETH1000
Enter another course name or press enter to end ==> COM1000
Enter another course name or press enter to end ==>
Here are the courses and grades:
Course Avg
COP1000 80.8% 73 %
MAT1000 85.0% 75 %
PHY1000 88.6% 78%
ETH1000 87.6% 79 %
COM1000 77.0% 71 %
Term average is 83.8%
Course Avg
Grades
---
75 %
77 %
88%
79 %
81%
90 %
80%
91% 96%
84% 87% 91%
72% 76%
Dropping the lowest grades...
Here are the courses and grades after dropping lowest grades:
91%
100 %
98%
97 %
77% 89%
Grades
COP1000 82.8% 75 % 77 %
88% 91%
MAT1000 87.5% 79% 81%
90% 100%
PHY1000 91.2% 80% 91% 96% 98%
ETH1000 89.8% 84% 87% 91% 97 %
COM1000 78.5% 72% 76% 77 % 89%
Term average is 86.0%
Dropping the lowest course: COM1000
Here are the courses and grades after dropping lowest course:
Course Avg
COP1000 82.8% 75 %
77 %
MAT1000 87.5% 79 %
81%
PHY1000 91.2% 80% 91%
ETH1000 89.8% 84% 87 %
Term average is 87.8%
Grades
88% 91%
90 % 100 %
96%
98%
91 %
97 %
Transcribed Image Text:Enter a course name ==> COP1000 Enter another course name or press enter to end ==> MAT1000 Enter another course name or press enter to end ==> PHY1000 Enter another course name or press enter to end ==> ETH1000 Enter another course name or press enter to end ==> COM1000 Enter another course name or press enter to end ==> Here are the courses and grades: Course Avg COP1000 80.8% 73 % MAT1000 85.0% 75 % PHY1000 88.6% 78% ETH1000 87.6% 79 % COM1000 77.0% 71 % Term average is 83.8% Course Avg Grades --- 75 % 77 % 88% 79 % 81% 90 % 80% 91% 96% 84% 87% 91% 72% 76% Dropping the lowest grades... Here are the courses and grades after dropping lowest grades: 91% 100 % 98% 97 % 77% 89% Grades COP1000 82.8% 75 % 77 % 88% 91% MAT1000 87.5% 79% 81% 90% 100% PHY1000 91.2% 80% 91% 96% 98% ETH1000 89.8% 84% 87% 91% 97 % COM1000 78.5% 72% 76% 77 % 89% Term average is 86.0% Dropping the lowest course: COM1000 Here are the courses and grades after dropping lowest course: Course Avg COP1000 82.8% 75 % 77 % MAT1000 87.5% 79 % 81% PHY1000 91.2% 80% 91% ETH1000 89.8% 84% 87 % Term average is 87.8% Grades 88% 91% 90 % 100 % 96% 98% 91 % 97 %
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Binary Search Algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education