WEEK-4 PDSA PYTHON NPTEL PROGRAMMING ASSIGNMENT 2020

Опубликовано: 21 Июль 2026
на канале: Glad you seen
485
16

If you like the video please share my channe in your class room groups and help me in getting 1k hearts.
Here is the code for pdsa python week4 programming assignment
pastebin url:
https://pastebin.com/tKnvK9SF
*******************************
code:
def orangecap(matches):
runs={}
for match in matches:
for player in matches[match]:
individual_score=matches[match][player]
if player in runs:
runs[player]+=individual_score
else:
runs[player]=individual_score

highest_runs=max(list(runs.values()))
for each in runs:
if runs[each]==highest_runs:
return tuple((each,highest_runs))


def addpoly(p1,p2):
total={}
final_expression=[]
for pol in [p1,p2]:
for i in pol:
if i[1] not in total:
total[i[1]]=i[0]
else:
total[i[1]]+=i[0]
pols=sorted(list(total.keys()),reverse=True)
for each in pols:
coefficient=total[each]
if coefficient!=0:
t=tuple((coefficient,each))
final_expression.append(t)
return final_expression



def multpoly(p1,p2):
first={}
second={}
final={}
for i in p1:
first[i[1]]=i[0]
for i in p2:
second[i[1]]=i[0]
for i in first.keys():
for j in second.keys():
final[i+j]=0
for i in first:
for j in second:
final[i+j]+=first[i]*second[j]
final_expression=[]
for i in sorted(final.keys(),reverse=True):
if final[i]!=0:
final_expression.append((final[i],i))
return final_expression
************************************