Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. You will develop a Letter Grade Counter Program as described below: a. In this modular program (using functions), you will create a dictionary-based gradebook
3. You will develop a Letter Grade Counter Program as described below: a. In this modular program (using functions), you will create a dictionary-based gradebook with student's name and letter grade as key-value pair. You will then count the number of similar grade letters (A, B, C, D, and F) initialized in a list and display a report (as shown in the screenshots below). Firstly, you will accept from the user the number of students to add to the gradebook. You will then prompt for each student's name and letter grade and create a dictionary-based gradebook. The program should then count the number of similar grade letters made by students and display a report as shown in the screenshot below: (NOTE: Other than the data input, your output should look EXACTLY like in the below table showing a few sample runs for you to compare, the items shown after the : and symbols are what you enter as input; those items can vary for each sample run): 1. 2. Welcome to Letter Grade Counter Program! Welcome to Letter Grade Counter Program! How many students do you want to add to the gradebook? 5 Enter the name of student #1: suma What is suna's grade? a Enter the name of student #2: Jess What is jess's grade? b Enter the name of student #3: nancy What is nancy's grade? Enter the name of student 14: j111 What is jill's grade? d Enter the name of student #5: Jack What is jack's grade? F How many students do you want to add to the gradebook? 5 Enter the name of student #1: suma What is suna's grade? a Enter the natle of student #2: charles What is charles's grade? A Enter the name of student #3: jim what is jin's grader a Enter the name of student #4: mary what is mary's grade? a Enter the name of student #5: anci What is anci's grade? a Grade Count Grade Count 3. Welcome to Letter Grade Counter Program! Welcome to Letter Grade Counter Program! How many students do you want to add to the gradebook? @ How many students do you want to add to the gradebook? 2 Enter the name of student #1: suma What is suma's grade? i Enter the name of student #2: rao What is rao's grade? ] Grade Count Grade Count 4. a. The first thing you should enter in your python program script file (CH9LastFirst.py file created in step 2) is a top comment block which includes the following: Name: Enter your full name here Lab: Chapters 9 Description: This needs to be at least a paragraph explanation of the program (in your own words) b. Below the top comment block, type the actual python code for the problem described in step 3. Make sure to include the functions as described below EXACTLY! (Refer to the sample code screenshot below with function calls and definition examples and HINTS): a. main() This main function should define the variables required and call the below functions (Refer to HINTS in line #ts b. Below the top comment block, type the actual python code for the problem described in step 3. Make sure to include the functions as described below EXACTLY! (Refer to the sample code screenshot below with function calls and definition examples and HINTS): a. main() This main function should define the variables required and call the below functions (Refer to HINTS in line #s 14 - 19 in the below sample program screenshot) b. fill_grade_book() This should be a value returning function called by main() function, that accepts no arguments. This function will accept from the user the number of students to add to the gradebook. Then, prompt for each student's name and letter grade and create a dictionary-based gradebook and returns the dictionary back to the main function (Refer to HINTS in line #s 23 - 31 in the below sample program screenshot) c. count_letter_grades() This should be a value returning function called by main function, that accepts one dictionary argument. The program should then count the number of similar grade letters made by students and store them in a counter list for different letter grades and return the list back to the main function (Refer to HINTS in line #s 33 - 40 in the below sample program screenshot) d. display_grade_report() This should be a void function called by main function that accepts one list argument that has the counts of similar grade letters and displays them as shown in the above output/results screenshots (Refer to HINTS in line #s 42-46 in the below sample program screenshot) Make sure to include the following in your program as well: i. Define appropriate/descriptive CONSTANTS/variable_names (Refer to line #s 8-12, 16-17, etc. in the below screenshot for examples) ii. Have enough documentation for understandability of your program by including a comment block at the beginning of the program (Refer to line #s 1 - 8 in the below screenshot) and prior to each function describing in your own words the purpose of each function by explaining the logic of loop, if, and other python functions used (refer to Textbook/Instructor EXAMPLE PROGRAMS listed in Canvas Modules) iii. Have proper indentation and line spacing for readability of your program (refer to Textbook/Instructor EXAMPLE PROGRAMS listed in Canvas Modules) CH9RaoSuma.py . C\01Sumayo1 Spring21\COSC1437Py\COSC1437Programs CH9RaoSuma.py 13.8.5) File Edit Format Run Options Window Help 2 Name: Enter your full name here 3 Lab: Chapters 9 4 Description: This needs to be at least a paragraph explanation of the program (in your own words) 5 6 7 13 8# CONSTANTS 9 PROGRAM_TITLE = " Welcome to Letter Grade Counter Program! " 10 GRADE_REPORT_TITLE = " Grade\tCount " 11 LINE = '.'*len(PROGRAM_TITLE) 12 GRADE_LETTERS = ['A', 'B', 'C', 'D', 'F'] 14 # MAIN PROGRAM DEFINITION BELOW 15 def main(): grade_book = { } grade_counter = [@]*len (GRADE_LETTERS) print (PROGRAM_TITLE+LINE) # HINT: Call functions (fill_grade_book, count_letter_grades, & display_grade_report) below... 20 16 17 18 19 21 26 27 28 29 30 31 32 22 23# DESCRIBE PURPOSE/LOGIC OF BELOW FUNCTION (in your own words) 24 def fill_grade_book(): 25 grade_book = {} num_students = int(input("How many students do you want to add to the gradebook?")) # HINT: using a for loop in the range length of num_students # HINT: prompt for student's name # HINT: prompt for student's grade and use upper function to capitalize it # HINT: fill grade_book dictionary with the grade entered # HINT: return the filled grade_book dictionary 33# DESCRIBE PURPOSE/LOGIC OF BELOW FUNCTION (in your own words) 34 # HINT: define count_letter_grade function heading # HINT: Initialize grade_counter list to like line #17 # HINT: using for loop find student in grade_book # HINT: using for loop of i in range length of GRADE_LETTERS 38 # HINT: use if to check the student's grade in gradebook is equal to GRADE_LETTERS[i] 39 # HINT: update grade_counter by 1 return grade_counter 42# DESCRIBE PURPOSE/LOGIC OF BELOW FUNCTION (in your own words) 43 # HINT: define display_grade_report function heading # HINT: print PROGRAM_TITLE with LINE above/below # HINT: Use for loop i in range length of GRADE_LETTERS # HINT: print GRADE_LETTERS[1] and grade_counter[i] with tab in between 47 48# MAIN FUNCTION CALL 49 main() 35 36 37 40 41 44 45 46
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