Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Assignment 3 part D (Please show code in code editor, spaces are easier to see in code editor than Chegg) Write a simple Python

Python Assignment 3 part D (Please show code in code editor, spaces are easier to see in code editor than Chegg)

Write a simple Python program to exercise lists w/as few lines possible.

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

image text in transcribed

******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

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

Students also viewed these Databases questions

Question

=+ Be able to differentiate misbehavior from performance issues.

Answered: 1 week ago