Create a program the user will input 5 grades (choose any subjects and input any grades). Determine individual subjects either passed or failed. Lastly, calculate the average grade and determine whether if passed or failed.
Sample output:
Student Name: Victoria Jimenez
Filipino: 80 - Passed
Math: 74 - Failed
Science: 89 - Passed
English: 74 - Failed
PE: 90 - Passed
Hi Victoria Jimenez, Your Average Grade is 81.4 and you are PASSED!
*If the grade is failed the output should be
Hi Victoria Jimenez, Your Average Grade is 74.3 and you are FAILED!
name = str(input("Enter your name: "))
n = int(input("Enter number of subjects: "))
count = 0
pass1 = 0
fail = 0
for i in range(n):
sub_name = str(input("Enter subject name: "))
grade = int(input("Enter grade in " + sub_name + ": "))
count += grade
if grade < 30:
fail += 1
print("FAILED")
else:
pass1 += 1
print("PASSED")
avg = count/n
if pass1 > fail:
print("Hi " + name + "Your Average Grade is " + str(avg) + " and you are PASSED!")
else:
print("Hi " + name + "Your Average Grade is " + str(avg) + " and you are FAILED!")
Comments
Leave a comment