-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWeek-5 (Programming Assignment)
More file actions
62 lines (52 loc) · 1.53 KB
/
Week-5 (Programming Assignment)
File metadata and controls
62 lines (52 loc) · 1.53 KB
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
def Gvalue(code):
if code=="A":
return(10)
if code=="AB":
return(9)
if code=="B":
return(8)
if code=="BC":
return(7)
if code=="C":
return(6)
if code=="CD":
return(5)
if code=="D":
return(4)
ROLL_GRADEsum={}
Roll_course_count={}
Roll_name={}
type_course=input()
enter_course_detail=input()
next_input=input()
while(next_input!="Students"):
next_input=input()
roll,name=input().split('~')
Roll_name[roll]=name
ROLL_GRADEsum[roll]=0
Roll_course_count[roll]=0
next_input=input()
while('~' in next_input):
roll,name=next_input.split('~')
Roll_name[roll]=name
ROLL_GRADEsum[roll]=0
Roll_course_count[roll]=0
next_input=input()
code,sem,year,Rnum,grade=input().split('~')
if Rnum in ROLL_GRADEsum.keys():
ROLL_GRADEsum[Rnum]=ROLL_GRADEsum[Rnum]+Gvalue(grade)
Roll_course_count[Rnum]=Roll_course_count[Rnum]+1
next_input=input()
while(next_input!="EndOfInput"):
code,sem,year,Rnum,grade=next_input.split('~')
if Rnum in ROLL_GRADEsum.keys():
ROLL_GRADEsum[Rnum]=ROLL_GRADEsum[Rnum]+Gvalue(grade)
Roll_course_count[Rnum]=Roll_course_count[Rnum]+1
next_input=input()
Sort_roll=sorted(Roll_name)
for key in Sort_roll:
if ROLL_GRADEsum[key]!=0:
ans=round((ROLL_GRADEsum[key]/Roll_course_count[key]),2)
print(key+"~"+Roll_name[key]+"~"+str(ans))
else:
print(key+"~"+Roll_name[key]+"~"+"0")