Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

2. Test Scores

File: test_scores.py

Write pseudocode for the main() part of a program that asks the user to enter 4 test scores between 0 and 100, then displays a JCU grade for each score and also the average test score.

When you have written the pseudocode for main, implement your solution in Python code and test it with a range of meaningful data.

Remember that we've done the JCU grades question before, so copy your function from that practical code file.

Sample Output

Score: 3
Score: 50.5
Score: 66
Score: 100
Score 3.0, which is N
Score 50.5, which is P
Score 66.0, which is C
Score 100.0, which is HD
The average score was 54.875

Enhancements

When you have that working...

  • We asked for 4 scores. Have a look at your code... did you use 4 as a numeric literal or a constant?
    Change 4 to 3... Did you have to change the program in more than one place?
    If so, then you've missed one of the things we've taught...
    As a strong guideline: if you need to use the same literal more than once, you should turn it into a constant .
    Do this now if you haven't already.

  • Add error-checking to the test score inputs to ensure they are between 0 and 100.
    You should be getting good at this by now :) but do notice that it's easy to do this kind of "iterative development" where you don't try and get it working all at once. Error-checking is a common feature to add after you have the core functionality working.

  • Add a feature that shows the user what the trend is.
    If the last score in the list is higher than the average, then the trend is "positive", otherwise it's "not positive".

  • Upgrade your print outputs so the output is formatted nicely like:

Score 1: 3
Score 2: 50.5
Score 3: 66
Score 4: 100
Score 1 was 3.0, which is N
Score 2 was 50.5, which is P
Score 3 was 66.0, which is C
Score 4 was 100.0, which is HD
The average score was 54.875
The trend is positive
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education