Question: Python Assignment 3 part D Write a Python program to exercise lists. Constraints: Display any decimal values with 2 digits after the decimal point The

Python Assignment 3 part D

Write a Python program to exercise lists.

Constraints:

  • Display any decimal values with 2 digits after the decimal point

  • The code must use lists and NOT static arrays

Process:

  • Ask for the number of students in a class. Make sure that the user enters 1 or more students. Need a validation loop here.

  • Read the name and the test score for each student in your lists. You will have a list to store the names and another list to store the test scores.

  • Calculate the best or highest score.

  • Calculate letter grades based on the following criteria:

    • A when score is >= best score - 10

    • B when score is >= best score - 20

    • C when score is >= best score - 30

    • D when score is >= best score - 40

    • F Otherwise.

  • Calculate and display the average of test scores.

  • Sort the names in alphabetical order and display the sorted list.

  • Sort the test scores in ascending order and display the sorted list.

  • SPECIAL NOTE: Youre sorting the names and test scores independently.

  • Allow the user to enter a students name and display the corresponding test score. Issue an error message if the name is not in the list of students. Use a loop to allow the user to enter as many names as the user wishes to enter. Use the sentinel value done to exit the search process. See the note at the end of this file for a simple algorithm to search for data.

Sample interaction:

Note that this is just a sample test case. Your code should work for any set of input. Your output should be VERY SIMILAR to the output shown below. The grade report heading and the format of the output must match.

Number of students: -1

Error try again

Number of students: 0

Error try again

Number of students: 4

Assume the entered values are: bill, joe, mary, bob

Assume the entered values are: 40 55 70 58

*** Grade Report ***

bill scored 40, grade is: C

joe scored 55, grade is: B

mary scored 70, grade is: A

bob scored 58, grade is: B

Average = 55.75

*** The sorted List of student names ***

bill

bob

joe

mary

*** The sorted List of student score ***

40

55

58

70

Enter a students name: joe

joe received a score of 55

Enter a students name: nancy

nancy is not a student

Python Assignment 3 part D Write a Python program to exercise lists.

******A simple process to search for data. Set found = 0 Set index=0 While found == 0 and index

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!