Skip to content

Commit 65a2228

Browse files
authored
Create Week-5 (Programming Assignment)
1 parent e8c4c49 commit 65a2228

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

Week-5 (Programming Assignment)

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
def Gvalue(code):
2+
if code=="A":
3+
return(10)
4+
if code=="AB":
5+
return(9)
6+
if code=="B":
7+
return(8)
8+
if code=="BC":
9+
return(7)
10+
if code=="C":
11+
return(6)
12+
if code=="CD":
13+
return(5)
14+
if code=="D":
15+
return(4)
16+
17+
18+
ROLL_GRADEsum={}
19+
Roll_course_count={}
20+
Roll_name={}
21+
22+
23+
type_course=input()
24+
enter_course_detail=input()
25+
next_input=input()
26+
while(next_input!="Students"):
27+
next_input=input()
28+
29+
30+
roll,name=input().split('~')
31+
Roll_name[roll]=name
32+
ROLL_GRADEsum[roll]=0
33+
Roll_course_count[roll]=0
34+
next_input=input()
35+
while('~' in next_input):
36+
roll,name=next_input.split('~')
37+
Roll_name[roll]=name
38+
ROLL_GRADEsum[roll]=0
39+
Roll_course_count[roll]=0
40+
next_input=input()
41+
42+
43+
code,sem,year,Rnum,grade=input().split('~')
44+
if Rnum in ROLL_GRADEsum.keys():
45+
ROLL_GRADEsum[Rnum]=ROLL_GRADEsum[Rnum]+Gvalue(grade)
46+
Roll_course_count[Rnum]=Roll_course_count[Rnum]+1
47+
next_input=input()
48+
while(next_input!="EndOfInput"):
49+
code,sem,year,Rnum,grade=next_input.split('~')
50+
if Rnum in ROLL_GRADEsum.keys():
51+
ROLL_GRADEsum[Rnum]=ROLL_GRADEsum[Rnum]+Gvalue(grade)
52+
Roll_course_count[Rnum]=Roll_course_count[Rnum]+1
53+
next_input=input()
54+
55+
56+
Sort_roll=sorted(Roll_name)
57+
for key in Sort_roll:
58+
if ROLL_GRADEsum[key]!=0:
59+
ans=round((ROLL_GRADEsum[key]/Roll_course_count[key]),2)
60+
print(key+"~"+Roll_name[key]+"~"+str(ans))
61+
else:
62+
print(key+"~"+Roll_name[key]+"~"+"0")

0 commit comments

Comments
 (0)