hacker rank python(finding the percentage)solution
FINDING THE PERCENTAGE
l,k=[],[]
a=int(input())
for i in range(a):
k=input().split()
l.append(k)
x=input()
for i in range(a):
if(l[i][0]==x):
c=float(l[i][1])+float(l[i][2])+float(l[i][3])
print("%.2f"%(c/3.0))
l,k=[],[]
a=int(input())
for i in range(a):
k=input().split()
l.append(k)
x=input()
for i in range(a):
if(l[i][0]==x):
c=float(l[i][1])+float(l[i][2])+float(l[i][3])
print("%.2f"%(c/3.0))
Comments