Answer to Question #332300 in Python for Kakay

Question #332300

The user will input 5 grades. Determine individual subjects either passed or failed. Lastly, calculate the average grade and determine whether if passed or failed.











Sample output:



Student Name: Jessica


Math: 74



Science: 89.5



English: 74



Geography: 82



Filipino: 80



*Average Grades: 79.9




*If the average grade is >= 75 the output should be



PASSED!




*If the subject grade is below 74 the output should be



You need to re-take in Math Subject and English Subject




*If the average grade is <= 74 the output should be



YOU FAILED!

1
Expert's answer
2022-04-22T13:30:27-0400
grades = []
retake = []
name = input("Input name: ")
subjects = ["Math", "Science", "English", "Geography", "Filipino"]
print("input 5 grades:")
for i in subjects:
    print(f"{i}: ", end='')
    grades.append(int(input()))
avg = 0
for i in range(5):
    avg += grades[i]
    if grades[i] < 74:
        retake.append(subjects[i])
avg = avg/5
print(f"Average Grades: {avg}")
if avg >= 75:
    print("PASSED!")
else:
    print("YOU FAILED!")
if len(retake)>0:
    print("You need to re-take in ", end='')
    for i in range(len(retake)):
        if i > 0:
            print(f" and {retake[i]} Subject", end='')
        else:
            print(f"{retake[i]} Subject", end='')
   

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS