Python Program to Take in the Marks of 5 Subjects and Display the Grade














































Python Program to Take in the Marks of 5 Subjects and Display the Grade



#Step 1: Ask the user to input the student name

Student_Name = input(
"Please enter the student's name: ")

#Step 2: Ask the user to input the grades for all five subjects and the names of the subjects.

Subject1 = input(
"Please enter the name of the first Subject: ")
Marks1 = int(input(
"Please enter your marks in " + Subject1 + ": "))

Subject2 = input(
"Please enter the name of the second Subject: ")
Marks2 = int(input(
"Please enter your marks in " + Subject2 + ": "))

Subject3 = input(
"Please enter the name of the third Subject: ")
Marks3 = int(input(
"Please enter your marks in " + Subject3 + ": "))

Subject4 = input(
"Please enter the name of the fourth Subject: ")
Marks4 = int(input(
"Please enter your marks in " + Subject4 + ": "))

Subject5 = input(
"Please enter the name of the fifth Subject: ")
Marks5 = int(input(
"Please enter your marks in " + Subject5 + ": "))

#Find the total sum of all the grades and then divide by 5 to get the average grade

fina_grade_average = (Marks1+Marks2+Marks3+Marks4+Marks5)/
5

print(
"The Overll Grade of ", Student_Name," is", fina_grade_average)

def main():
if __name__ == '__main__':
main()

Output:

/Users/sana2398/Desktop/Sana/CPPSecrets/venv/bin/python "/Users/sana2398/Desktop/Sana/CPPSecrets/Python Program to Take in the Marks of 5 Subjects and Display the Grade.py"
Please enter the student's name: Sana
Please enter the name of the first Subject: Mathematics
Please enter your marks in Mathematics:
70
Please enter the name of the second Subject: Science
Please enter your marks in Science:
80
Please enter the name of the third Subject: English
Please enter your marks in English:
80
Please enter the name of the fourth Subject: History
Please enter your marks in History:
80
Please enter the name of the fifth Subject: Geography
Please enter your marks in Geography:
80
The Overll Grade of Sana is
78.0

Process finished with
exit code 0

Comments