Source Code:
def cgpa_display():
total1=0
gtotal=0
grades={"s":"10","S":"10","a":"9","A":"9","b":"8", "B":"8","c":"7", "C":"7","d":"6","D":"6","e":"5","E":"5","f":"4","F":"4"}
name=raw_input("\n Enter the student name:")
dept=raw_input("\n Enter the department:")
year=raw_input("\n Enter the Year of student:")
sem=raw_input("\n Enter the semester of the student:")
n=int(raw_input("\n Enter the No. of Subjects:"))
print"\n Enter the grades in (S-E) F-arrear"
marks=[]
for entry in range(n):
sc=raw_input("\n Enter the subject code:")
ma=raw_input("\n Enter the grades in (S-E):")
g=float(raw_input("\n Enter the grade points:"))
if ma in grades:
m=float(grades[ma])
ma=ma.upper()
entry=(sc,g,m,ma)
marks.append(entry)
if ma=="F":
mn="0"
else:
mn="1"
if mn=="0":
print"\n\tNAME:",name,"\t\tDEPARTMENT:",dept
print"\n\tYEAR:",year,"\t\tSEMESTER:",sem
print"\n Subject code Grade"
for entry in marks:
sc,g,m,ma=entry
print"\n\t",sc,"\t\t",ma
print"\n\nCGPA=ARREAR"
else:
print"\n\tNAME:",name,"\t\tDEPARTMENT:",dept
print"\n\tYEAR:",year,"\t\tSEMESTER:",sem
print"\n Subject code Grade"
for entry in marks:
sc,g,m,ma=entry
print"\n\t",sc,"\t\t",ma
total1=total1+m*g
gtotal=gtotal+g
cgpa=total1/gtotal
print"\n\nCGPA=",cgpa
cgpa_display()
raw_input("\n Press enter key to exit....")
Output:
Enter the student name:Rajiv Ranjan V
Enter the department:Mechanical
Enter the year of student:4
Enter the semester of the student:7
Enter the No. of Subjects:8
Enter the grades in (S-E) F-arrear
Enter the subject code:701
Enter the grades in (S-E):S
Enter the grade point:3.5
Enter the subject code:702
Enter the grades in (S-E):A
Enter the grade point:3.5
Enter the subject code:703
Enter the grades in (S-E):A
Enter the grade point:3
Enter the subject code:704
Enter the grades in (S-E):B
Enter the grade point:3
Enter the subject code:705
Enter the grades in (S-E):A
Enter the grade point:3
Enter the subject code:706
Enter the grades in (S-E):A
Enter the grade point:3.5
Enter the subject code:711
Enter the grades in (S-E):S
Enter the grade point:1.5
Enter the subject code:712
Enter the grades in (S-E):S
Enter the grade point:1.5
NAME:Rajiv Ranjan V DEPARTMENT:Mechanical
YEAR:4 SEMESTER:7
Subject code Grade
701 S
702 A
703 A
704 B
705 A
706 A
711 S
712 S
CGPA=9.1555555556
Press enter key to exit....
def cgpa_display():
total1=0
gtotal=0
grades={"s":"10","S":"10","a":"9","A":"9","b":"8", "B":"8","c":"7", "C":"7","d":"6","D":"6","e":"5","E":"5","f":"4","F":"4"}
name=raw_input("\n Enter the student name:")
dept=raw_input("\n Enter the department:")
year=raw_input("\n Enter the Year of student:")
sem=raw_input("\n Enter the semester of the student:")
n=int(raw_input("\n Enter the No. of Subjects:"))
print"\n Enter the grades in (S-E) F-arrear"
marks=[]
for entry in range(n):
sc=raw_input("\n Enter the subject code:")
ma=raw_input("\n Enter the grades in (S-E):")
g=float(raw_input("\n Enter the grade points:"))
if ma in grades:
m=float(grades[ma])
ma=ma.upper()
entry=(sc,g,m,ma)
marks.append(entry)
if ma=="F":
mn="0"
else:
mn="1"
if mn=="0":
print"\n\tNAME:",name,"\t\tDEPARTMENT:",dept
print"\n\tYEAR:",year,"\t\tSEMESTER:",sem
print"\n Subject code Grade"
for entry in marks:
sc,g,m,ma=entry
print"\n\t",sc,"\t\t",ma
print"\n\nCGPA=ARREAR"
else:
print"\n\tNAME:",name,"\t\tDEPARTMENT:",dept
print"\n\tYEAR:",year,"\t\tSEMESTER:",sem
print"\n Subject code Grade"
for entry in marks:
sc,g,m,ma=entry
print"\n\t",sc,"\t\t",ma
total1=total1+m*g
gtotal=gtotal+g
cgpa=total1/gtotal
print"\n\nCGPA=",cgpa
cgpa_display()
raw_input("\n Press enter key to exit....")
Output:
Enter the student name:Rajiv Ranjan V
Enter the department:Mechanical
Enter the year of student:4
Enter the semester of the student:7
Enter the No. of Subjects:8
Enter the grades in (S-E) F-arrear
Enter the subject code:701
Enter the grades in (S-E):S
Enter the grade point:3.5
Enter the subject code:702
Enter the grades in (S-E):A
Enter the grade point:3.5
Enter the subject code:703
Enter the grades in (S-E):A
Enter the grade point:3
Enter the subject code:704
Enter the grades in (S-E):B
Enter the grade point:3
Enter the subject code:705
Enter the grades in (S-E):A
Enter the grade point:3
Enter the subject code:706
Enter the grades in (S-E):A
Enter the grade point:3.5
Enter the subject code:711
Enter the grades in (S-E):S
Enter the grade point:1.5
Enter the subject code:712
Enter the grades in (S-E):S
Enter the grade point:1.5
NAME:Rajiv Ranjan V DEPARTMENT:Mechanical
YEAR:4 SEMESTER:7
Subject code Grade
701 S
702 A
703 A
704 B
705 A
706 A
711 S
712 S
CGPA=9.1555555556
Press enter key to exit....
0 comments:
Post a Comment