-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path8.py
More file actions
29 lines (28 loc) · 626 Bytes
/
8.py
File metadata and controls
29 lines (28 loc) · 626 Bytes
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
def Average(StuDict,Student):
s=0
for i in StuDict:
if i==Student:
l=StuDict.get(i)
break
for ch in l:
num=eval(ch)
s+=num
avg=s/len(l)
avg="{:.2f}".format(avg) #to round off upto 2 decimal places
return avg
def main():
StuDict={}
N=int(input())
for i in range(N):
lst=[]
IString=input()
l=IString.split()
k=l[0]
lst.extend([l[1],l[2],l[3]])
StuDict.update({k:lst})
#print(StuDict)
stu=input()
avg=Average(StuDict,stu)
print(avg)
if __name__=='__main__':
main()