Programming, Data Structures And Algorithms Using Python Week 4 NPTEL Assignment Answers 2025

Need help with this week’s assignment? Get detailed and trusted solutions for Programming, Data Structures And Algorithms Using Python Week 4 NPTEL Assignment Answers. Our expert-curated answers help you solve your assignments faster while deepening your conceptual clarity.

✅ Subject: Programming, Data Structures And Algorithms Using Python (nptel programming, DSA using python answers)
📅 Week: 4
🎯 Session: NPTEL 2025 July-October
🔗 Course Link: Click Here
🔍 Reliability: Verified and expert-reviewed answers
📌 Trusted By: 5000+ Students

For complete and in-depth solutions to all weekly assignments, check out 👉 NPTEL Programming, Data Structures and Algorithms using Python Week 4 Assignment Answers

🚀 Stay ahead in your NPTEL journey with fresh, updated solutions every week!

Programming, Data Structures And Algorithms Using Python Week 4 NPTEL Assignment Answers 2025

1. Consider the following Python function.

def mystery(l):
if l == []:
return(l)
else:
return(l[-1:]+mystery(l[:-1]))

What does mystery([23,35,19,58,93,46]) return?

Answer : See Answers

2. What is the value of pairs after the following assignment?

pairs = [ (x,y) for x in range(6,1,-1) for y in range(3,1,-1) if (x+y)%2 == 0 ]

Answer :

3. Consider the following dictionary.

goals = {“Country”:{“Ronaldo”:123,”Messi”:103,”Pele”:83},”Club”:{“Ronaldo”:[512,51,158],”Pele”:[604,49,26]}}

Which of the following statements does not generate an error?

  • goals[“Club”][“Messi”][0:] = [496,71,145]
  • goals[“Club”][“Messi”].extend([496,71,145])
  • goals[“Club”][“Messi”] = [496,71,145]
  • goals[“Club”][“Messi”] = goals[“Club”][“Messi”] + [496,71,145]
Answer :

4. Assume that wickets has been initialized as an empty dictionary:

wickets = {}

Which of the following generates an error?

  • wickets[“Muralitharan, tests”] = 800
  • wickets[“Muralitharan”] = {“tests”:800}
  • wickets[(“Muralitharan”,”tests”)] = 800
  • wickets[[“Muralitharan”,”tests”]] = 800
Answer : See Answers