Python Program to calculate the Grade of the Student

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74``` ```#Class will take five parameters from the calling function class Grade: #constructor will pass the parameters to the CalGrade function def __init__(self, first, second, third, fourth, fifth): self.first = first self.second = second self.third = third self.fourth = fourth self.fifth = fifth def CalGrade(self): #Average is calculated average = (self.first + self.second + self.third + self.fourth + self.fifth)/ 5 print(" Your average is ", average) #average is checked for evaluating the Grade of the student if (90 <= average <= 100) : print(" You have obtained Grade A ") elif (80 <= average < 90) : print(" You have obtained Grade B ") elif (70 <= average < 80) : print(" You have obtained Grade C ") elif (60 <= average < 70) : print(" You have obtained Grade D ") else: print(" You have obtained Grade F ") if __name__ == "__main__": first = int(input(" Enter the marks obtained in first subject: ")) second = int(input(" Enter the marks obtained in second subject: ")) third = int(input(" Enter the marks obtained in third subject: ")) fourth = int(input(" Enter the marks obtained in fourth subject: ")) fifth = int(input(" Enter the marks obtained in fifth subject: ")) #Object is created for class Grade Grade_obj = Grade(first, second, third, fourth, fifth) #CalGrade function is called Grade_obj.CalGrade() OUTPUT: Case 1: Enter the marks obtained in first subject: 85 Enter the marks obtained in second subject: 74 Enter the marks obtained in third subject: 65 Enter the marks obtained in fourth subject: 85 Enter the marks obtained in fifth subject: 95 Your average is 80.8 You have obtained Grade B Case 2: Enter the marks obtained in first subject: 35 Enter the marks obtained in second subject: 12 Enter the marks obtained in third subject: 23 Enter the marks obtained in fourth subject: 25 Enter the marks obtained in fifth subject: 35 Your average is 26.0 You have obtained Grade F LIMITATION: Do not enter strings or characters in place of the subject marks. ```

More Articles of Anjani Dubey:

Name Views Likes
Python program to check if a Binary tree is height balanced or not 902 16
Python program to convert BST into MinHeap 447 18
Python program to delete an element into AVL Tree 870 19
Python program to insert an element in AVL Tree 473 27
Python program to delete an element in Binary search tree 442 18
Python program to insert and find an element in Binary Search Tree 513 18
Python program to insert an element in the Binary Tree 761 18
Python program to find height of the Binary Search Tree(BST) 574 11
Python program to combine two sorted lists and make another sorted list 418 16
Python program to convert multiple integers into single integer 727 22
Python program to convert Nested list into a flat list 527 17
Python program to convert tuple to a string 601 26
Python program for traversing the Tree in PreOrder, PostOrder and InOrder 741 13
Python program to find hash of a string 379 28
Python program for Counting sort Algorithm 307 13
Python program for Insertion sort Algorithm 499 23
Python program for Bubble Sort algorithm 384 12
Python program for UNIX domain socket UDP client 341 15
Python UNIX domain socket UDP server 422 24
Python program for Binary Search Tree 438 20
Python UNIX domain socket TCP Client 316 16
Python UNIX domain socket TCP Server 383 16
Python program to convert POS to SOP 341 15
Advantages of UNIX domain socket over Normal sockets 628 24
Python program for Merge Sort Algorithm 382 21
Python program to print duplicate characters and count from a string 1535 20
Python program to find all pairs of an integer array whose sum is equal to a given number 1192 18
Python program to find all Permutations of a string 347 11
Python program to reverse the string using recursion 444 15
Python program to check two strings are anagrams of each other 712 22
Python program to convert Hexadecimal to Decimal, Binary, Octal 1763 27
Python program to convert Octal to Decimal, Binary, Hexadecimal 1850 28
Python program to Shuffle deck of cards 907 18
Python program for One Dimensional Array 333 23
Python program to merge mails 334 19
Python program to display powers of 2 380 20
Python program to find numbers Divisible by Another number 1007 24
Python program to print strings 297 14
Python program to find Average of numbers 307 23
Python program to find the solutions for a Quadratic equation 772 18
Python program to generate Armstrong numbers for a specific range 253 17
Python program to calculate perimeter of Triangle 379 23
Python program to calculate perimeter of a Rectangle 303 18
Python program to calculate the factors of a number 255 11
Python program to calculate the Square root of a number 478 19
Python program to calculate the area of Rectangle 322 17
Python program to print the Floyd Triangle 278 15
Python program to find the sum of natural number using Recursion 326 17
Python program to find the Fibonacci sequence recursion 426 30
Python Program to check whether a number is Palindrome or not 498 11
Program to check whether a number is Palindrome or not 456 17
Program to find average of numbers 318 16
Program to solve the Quadratic Equation 358 19
Program to generate the Armstrong numbers for a specific range 307 21
Program to calculate the perimeter of triangle 342 22
Program to calculate the perimeter of rectangle 479 14
Program to Display the Fibonacci series using Recursion 241 14
Program to find factors of a number 275 18
Program to calculate Square root of a number 244 18
Program to calculate area of Rectangle 303 25
Python Program for calculating the Area of Triangle 294 22
Program to print the Floyd Triangle 268 20
Python Program to calculate the Grade of the Student 5963 21
Program to calculate sum of natural numbers using Recursion 254 18