Simple code to find student result e.g (Total marks, Percentage , student GPA )

`````````````````````````````````````````````````````````````````````````````````````````````

This code put in python idle or any other idle to find student result easily

`````````````````````````````````````````````````````````````````````````````````````````````



 class DMC:

    def __init__(self,sub_1,sub_2,sub_3,sub_4,sub_5,sub_6):

        self.programming=sub_1

        self.calulas=sub_2

        self.english=sub_3

        self.islamyat=sub_4

        self.physics=sub_5

        self.computing=sub_6

    def TotalMarks(self):

        Total=self.programming+self.calulas+self.english+self.islamyat+self.physics+self.computing

        if Total<0 or Total>600:

            print("Enter the marks")

        else:

            return Total

    def percentage(self):

        return round(self.TotalMarks()/6,0)

    def GPA(self):

        if (self.percentage()>=85 and self.percentage()<=85):

            return 4.0

        elif self.percentage()>=80 and self.percentage()<=84:

            return 3.67

        elif self.percentage()>=75 and self.percentage()<=79:

            return 3.33

        elif self.percentage()>=70 and self.percentage()<=7:

            return 3.00

        elif self.percentage()>=65 and self.percentage()<=69:

            return 2.67

        elif self.percentage()>=61 and self.percentage()<=64:

            return 2.33

        elif self.percentage()>=58 and self.percentage()<=60:

            return 2.00

        elif self.percentage()>=55 and self.percentage()<=57:

            return 1.67

        elif self.percentage()>=53 and self.percentage()<=54:

            return 1.33

        elif self.percentage()>=50 and self.percentage()<=52:

            return 1.00

        else:

            return 0

 

    def Grade(self):

        if self.GPA()==4.0:

            return "A"

        elif self.GPA()==3.67:

            return"A-"

        elif self.GPA()==3.33:

            return"B+"

        elif self.GPA()==3.00:

            return"B"

        elif self.GPA()==2.67:

            return"B-"

        elif self.GPA()==2.33:

            return"C+"

        elif self.GPA()==2.00:

            return"C"

        elif self.GPA()==1.67:

            return"C-"

        elif self.GPA()==1.33:

            return"D+"

        elif self.GPA()==1.00:

            return"D"

        else:

            return"F"

    def Result(self):

        print(f"""

Result:

    Total Marks={self.TotalMarks()}

    percentage={self.percentage()}%

    GPA={self.GPA()}

    Grade={self.Grade()}

""")

calculate=DMC(

    int(input("Enter marks in programming:")),

    int(input("Enter marks in calulas:")),

    int(input("Enter marks in english:")),

    int(input("Enter marks in islamyat:")),

    int(input("Enter marks in physics:")),

    int(input("Enter marks in computing:")),

    )


calculate.Result()   




Click on link to download code:

https://drive.google.com/file/d/1THLkiPi799iPSpHN3Pss2nuVE7ABX0z9/view?usp=sharing 

Good luck:




Comments

Post a Comment

Popular posts from this blog

Python code to convert length into feet, inches, yards, miles, millimeters, centimeters, meters, kilometer.

Python code to find operation of two rational numbers