Are you looking for the Answers to **NPTEL Programming Data Structures And Algorithms Using Python Assignment 4? **This article will help you with the answer to the **Nation**** al Programme on Technology Enhanced Learning (NPTEL)** Course “

**NPTEL**“

**Programming Data Structures And Algorithms Using Python Assignment 4**## What is Programming Data Structures And Algorithms Using Python?

While hard skills teach us what to do, soft skills tell us how to apply our hard skills in a social environment. The focus of the course is to develop a wide variety of soft skills starting from communication, to working in different environments, developing emotional sensitivity, learning creative and critical decision making, developing awareness of how to work with and negotiate with people and to resolve stress and conflict in ourselves and others.

The uniqueness of the course lies in how a wide range of relevant issues are raised, relevant skills discussed and tips for integration provided in order to make us effective in workplace and social environments.

## CRITERIA TO GET A CERTIFICATE

Average assignment score = 25% of the average of best 8 assignments out of the total 12 assignments given in the course.

Exam score = 75% of the proctored certification exam score out of 100

Final score = Average assignment score + Exam score

**YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.**

** Below you can find the answers for Programming Data Structures And Algorithms Using Python Assignment 4**

Assignment No. | Answers |
---|---|

Programming Data Structures Assignment 1 | Click Here |

Programming Data Structures Assignment 2 | Click Here |

Programming Data Structures Assignment 3 | Click Here |

Programming Data Structures Assignment 4 | Click Here |

Programming Data Structures Assignment 5 | Click Here |

Programming Data Structures Assignment 6 | Click Here |

Programming Data Structures Assignment 7 | Click Here |

Programming Data Structures Assignment 8 | Click Here |

## Programming Data Structures And Algorithms Using Python Assignment 4 Answers:-

**Q1. Consider the following Python function.**

```
def mystery(l,v):
if len(l) == 0:
return (v)
else:
return (mystery(l[:-1],l[-1]+v))
```

What does mystery([22,14,19,65,82,55],1) return?

**Answer:- 258**

**Q2. What is the value of triples after the following assignment?**

`triples = [ (x,y,z) for x in range(2,4) for y in range(2,5) for z in range(5,7) if 2*x*y > 3*z ]`

**Answer:- ** **[(2,4,5),(3,3,5),(3,4,5),(3,4,6)]**

???? **Next Week Answers: Assignment 04** ????

**Q3. Consider the following dictionary.**

runs = {"Test":{"Rahul":[90,14,35],"Kohli":[3,103,73,42],"Pujara":[53,15,133,8]},"ODI":{"Sharma":[37,99],"Kohli":[63,47]}}

**Answer:- d**

**Q4. Assume that actor has been initialized as an empty dictionary:**

`actor = {}`

**Answer:- c – actor[[“Star Wars”, “Rey”]] = “Ridley”**

## Programming Assignment:-

**Q1. **

We represent scores of batsmen across a sequence of matches in a two level dictionary as follows: Each match is identified by a string, as is each player. The scores are all integers. The names associated with the matches are not fixed (here they are ‘match1’, ‘match2’, ‘match3’), nor are the names of the players. A player need not have a score recorded in all matches.

Define a Python function orangecap(d) that reads a dictionary d of this form and identifies the player with the highest total score. Your function should return a pair (playername,topscore) where playername is a string, the name of the player with the highest score, and topscore is an integer, the total score of playername.

The input will be such that there are never any ties for highest total score.

**Code:-**

```
def orangecap(d):
scr = dict()
for m in d:
for p in d[m]:
if p in scr:
scr[p] += d[m][p]
else:
scr[p] = d[m][p]
pn=str()
tscr=0
for p in scr:
if scr[p] > tscr:
tscr = scr[p]
pn = p
return (pn, tscr)
def addpoly(p1, p2):
r = list()
for a in range(len(p1)):
for j in range(len(p2)):
if p1[a][1] == p2[j][1]:
r += [(p1[a][0] + p2[j][0], p1[a][1])]
for k in range(len(r)):
if r[k][1] == p1[a][1]:
break
else:
r += [p1[a]]
for j in range(len(p2)):
for k in range(len(r)):
if r[k][1] == p2[j][1]:
break
else:
r += [p2[j]]
r = [(c, e) for (c, e) in r if c != 0]
r.sort(key= lambda l : l[1], reverse=True)
return r
def multpoly(p1, p2):
r = list()
for i in range(len(p1)):
for j in range(len(p2)):
r = addpoly([(p1[i][0] * p2[j][0], p1[i][1] + p2[j][1])], r)
return r
```

**For other courses answers:- Visit**

**For Internship and job updates:- Visit **

**Disclaimer:** We do not claim 100% surety of answers, these answers are based on our sole knowledge, and by posting these answers we are just trying to help students, so we urge do your assignment on your own.

if you have any suggestions then comment below or contact us at [email protected]

If you found this article Interesting and helpful, don’t forget to share it with your friends to get this information.