WAP which accepts marks of four subjects and display total marks, percentage and grade.Hint: more than 70 –> distinction, more than 60 –> first, more than 40 –> pass, less than 40 –> fail
Question
WAP which accepts marks of four subjects and display total marks, percentage and grade.Hint: more than 70 –> distinction, more than 60 –> first, more than 40 –> pass, less than 40 –> fail
Solution
Sure, here is a Python program that accepts marks of four subjects and displays the total marks, percentage, and grade.
# Accepting marks of four subjects from the user
sub1 = int(input("Enter marks of the first subject: "))
sub2 = int(input("Enter marks of the second subject: "))
sub3 = int(input("Enter marks of the third subject: "))
sub4 = int(input("Enter marks of the fourth subject: "))
# Calculating total marks
total = sub1 + sub2 + sub3 + sub4
print("Total Marks = ", total)
# Calculating percentage
percentage = (total / 400) * 100
print("Percentage = ", percentage)
# Determining grade
if percentage >= 70:
print("Grade = Distinction")
elif percentage >= 60:
print("Grade = First")
elif percentage >= 40:
print("Grade = Pass")
else:
print("Grade = Fail")
This program first takes the marks of four subjects as input from the user. It then calculates the total marks and the percentage. Based on the percentage, it determines the grade and prints it. If the percentage is 70 or above, the grade is 'Distinction'. If it's between 60 and 69, the grade is 'First'. If it's between 40 and 59, the grade is 'Pass'. If it's less than 40, the grade is 'Fail'.
Similar Questions
WAP in Java to accept five subjects marks and calculate the total and average marks. Example : Input : 85 90 92 79 83 Output : Total Marks : 429 Average Marks : 85.8
A student got 42% marks and has secured 12 marks more than the minimum passing marks. Another student got 45% has obtained 30 marks more than the minimum passing marks. The maximum marks are
Exam GradesScore Count[40–50) 1[50–60) 2[60–70) 4[70–80) 5[80–90) 2[90–100] 1What percentage of students earned less than a grade of 70 on the exam?9%15%47%53%93%
A student has to secure 40% marks in an examination to qualify. He gets 120 marks and fails by 80 marks. The maximum marks is
A student has to secure 40% marks to pass a test. He got 30 marks and failed by 50 marks. What is themaximum marks of the test ?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.