Python - Student Grade Calculation
|
Python - Student Grade Calculation |
Source Code
Aim :
To write a program to take in the marks of 5 subjects and display the grade in python
Algorithm :
- Get the required input from the user by using input statement for 'a' represents the first subject, 'b' represents the second subject, 'c' represents the third subject, 'd' represents the fourth subject, 'e' represents the fifth subject and 'avg' represents average.
- Program for Student Grade Calculation using the following 'if' statement condition and 'elif' statement condition.
- Display the result with the help of print statement
Program :
#Program to take in the marks of 5 subjects and display the grade
#'a' represents the first subject, 'b' represents the second subject, 'c' represents the third subject,
#'d' represents the fourth subject, 'e' represents the fifth subject and 'avg' represents average
#and get input from user
a = int(input("Enter marks of the first subject : "))
b = int(input("Enter marks of the second subject : "))
c = int(input("Enter marks of the third subject : "))
d = int(input("Enter marks of the fourth subject : "))
e = int(input("Enter marks of the fifth subject : "))
avg = (a+b+c+d+e)/5
if(avg>=90):
print("Grade - A")
elif(avg>=80 and avg<90):
print("Grade - B")
elif(avg>=70 and avg<80):
print("Grade - C")
elif(avg>=60 and avg<70):
print("Grade - D")
else:
print("Grade - F")
Output :
Enter marks of the first subject :
100
Enter marks of the second subject :
100
Enter marks of the third subject :
100
Enter marks of the fourth subject :
100
Enter marks of the fifth subject :
100
Grade - A
Terminal Code :
|
Python - Student Grade Calculation Program01
|
|
Python - Student Grade Calculation Program02 |
Terminal Output :
|
Python - Student Grade Calculation Output |
Result :
The output was executed successfully and result was verified.
Personal Writings for Readers!!!
Story behind single family described in Pandemic Family Book.
Read more on...
Paperback - https://amzn.to/34NS6Sk
Amazon Kindle - https://amzn.to/3aKtIng
Kobo Writing - https://bit.ly/3iQysNy
Comments
Post a Comment