OPA Solution for Unix, Python 15-05-2020
- Anuj Yadav
- May 23, 2020
- 1 min read
UNIX Solution:(15 marks)
There was only one question. There were 20 minutes allocated for this section.




Solution:
cat $1 > file.txt
min=`sed '1d' file.txt|sort -nt ',' -k3|head -1|cut -d ',' -f3`
sed '1d' file.txt|cut -d',' -f3 file.txt| grep -wc $minPython Solution:(35 marks)
There was only one OOPs question. There were 50 minutes allocated for this section.







class P: def __init__(self,pid,pname,sd): self.pid=pid self.pname=pname self.sd=sdclass U: # def __init__(self): # pass def g(self,l,id): sum=0 for i in l: if i.pid==id: for k in i.sd: sum=sum+i.sd[k] return sum # print(i.pname) def s(self,l,n): h=0 res=None for i in l: for j in i.sd: if j.lower()==n.lower(): if i.sd[j]>h: h=i.sd[j] res=i return res n=int(input())l=[]for i in range(n): pid=int(input()) pname=input() k=int(input()) d=dict() for j in range(k): s=input() e=int(input()) d[s]=e # print(d) o=P(pid,pname,d) l.append(o)id=int(input())n=input()temp=U()print(temp.g(l,id))k=temp.s(l,n)if k is None: print(k)else: print(k.pid,k.pname,k.sd,end="")




Comments