Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is what I have I didn't know how else to do it without using a list, I'd like to replace my list with a

This is what I have I didn't know how else to do it without using a list, I'd like to replace my list with a loop to fit the question better.

here is the question: write a program that asks the user to enter five test scores (use an appropriate loop). The program should display a letter grade for each score and the average test score (use an appropriate loop)

example of output:

Enter Score 1: 88 Enter Score 2: 79.5 Enter Score 3: 86.9 Enter Score 4: 95.7 Enter Score 5: 65.3 Score Numeric Grade Letter Grade ====================================================== Score 1: 88.0 B Score 2: 79.5 C Score 3: 86.9 B Score 4: 95.7 A Score 5: 65.3 D ====================================================== Average Score: 83.08 B 

my code:

list1 = []

grade = float(input("Enter Score 1: "))

list1.append(grade)

grade = float(input("Enter Score 2: "))

list1.append(grade)

grade = float(input("Enter Score 3: "))

list1.append(grade)

grade = float(input("Enter Score 4: "))

list1.append(grade)

grade = float(input("Enter Score 5: "))

list1.append(grade)

print("Score\t\tNumeric Grade\t\tLetter Grade")

print("======================================================")

if (list1[0] >= 90.00):

print("Score 1:\t",list1[0],"\t\t\tA")

elif (list1[0] >=80.00 and list1[0] <= 89.99):

print("Score 1:\t",list1[0],"\t\t\tB")

elif (list1[0] >=70.00 and list1[0] <= 79.99):

print("Score 1:\t",list1[0],"\t\t\tC")

elif (list1[0] >=60.00 and list1[0] <= 69.99):

print("Score 1:\t",list1[0],"\t\t\tD")

else:

print("Score 1:\t",list1[0],"\t\t\tF")

if (list1[1] >= 90.00):

print("Score 2:\t",list1[1],"\t\t\tA")

elif (list1[1] >=80.00 and list1[1] <= 89.99):

print("Score 2:\t",list1[1],"\t\t\tB")

elif (list1[1] >=70.00 and list1[1] <= 79.99):

print("Score 2:\t",list1[1],"\t\t\tC")

elif (list1[1] >=60.00 and list1[1] <= 69.99):

print("Score 2:\t",list1[1],"\t\t\tD")

else:

print("Score 2:\t",list1[1],"\t\t\tF")

if (list1[2] >= 90.00):

print("Score 3:\t",list1[2],"\t\t\tA")

elif (list1[2] >=80.00 and list1[2] <= 89.99):

print("Score 3:\t",list1[2],"\t\t\tB")

elif (list1[2] >=70.00 and list1[2] <= 79.99):

print("Score 3:\t",list1[2],"\t\t\tC")

elif (list1[2] >=60.00 and list1[2] <= 69.99):

print("Score 3:\t",list1[2],"\t\t\tD")

else:

print("Score 3:\t",list1[2],"\t\t\tF")

if (list1[3] >= 90.00):

print("Score 4:\t",list1[3],"\t\t\tA")

elif (list1[3] >=80.00 and list1[3] <= 89.99):

print("Score 4:\t",list1[3],"\t\t\tB")

elif (list1[3] >=70.00 and list1[3] <= 79.99):

print("Score 4:\t",list1[3],"\t\t\tC")

elif (list1[3] >=60.00 and list1[3] <= 69.99):

print("Score 4:\t",list1[3],"\t\t\tD")

else:

print("Score 4:\t",list1[3],"\t\t\tF")

if (list1[4] >= 90.00):

print("Score 5:\t",list1[4],"\t\t\tA")

elif (list1[4] >=80.00 and list1[4] <= 89.99):

print("Score 5:\t",list1[4],"\t\t\tB")

elif (list1[4] >=70.00 and list1[4] <= 79.99):

print("Score 5:\t",list1[4],"\t\t\tC")

elif (list1[4] >=60.00 and list1[4] <= 69.99):

print("Score 5:\t",list1[4],"\t\t\tD")

else:

print("Score 5:\t",list1[4],"\t\t\tF")

print("======================================================")

avg_value = sum(list1)/len(list1)

if (avg_value >= 90.00):

print(" Average Score:\t", round(avg_value,2),"\t\t\tA")

elif (avg_value >=80.00 and avg_value <= 89.99):

print(" Average Score:\t", round(avg_value,2),"\t\t\tB")

elif (list1[4] >=70.00 and list1[4] <= 79.99):

print(" Average Score:\t", round(avg_value,2),"\t\t\tC")

elif (list1[4] >=60.00 and list1[4] <= 69.99):

print(" Average Score:\t", round(avg_value,2),"\t\t\tD")

else:

print(" Average Score:\t", round(avg_value,2),"\t\t\tF")

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions