Need help with this week’s assignment? Get detailed and trusted solutions for Python for Data Science Week 2 NPTEL Assignment Answers. Our expert-curated answers help you solve your assignments faster while deepening your conceptual clarity.
✅ Subject: Python for Data Science
📅 Week: 2
🎯 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 Python for Data Science Week 2 NPTEL Assignment Answers
🚀 Stay ahead in your NPTEL journey with fresh, updated solutions every week!
NPTEL Python for Data Science Week 2 Assignment Answers 2025
1. Which of the following object does not support indexing?
- tuple
- list
- dictionary
- set
Answer : See Answers
2. How can you concatenate the strings “data” and “science” with a hyphen(-) between them?
- “data”.join(“science”)
- “-”.join([“data”, “science”])
- “data” + “-” + “science”
- None of the above.
Answer :
3. What will be the output of the following code snippet?

- [[ 5 12]
[21 32]] - [[19 22]
[43 50]] - [[3 8]
[35 56]] - [[ 5 21]
[12 32]]
Answer :
4. What will be the output of the following code snippet?

- [ 1 10 3 4 5 6 7 8 9 10]
- [ 10 1 2 3 4 5 6 7 8 9]
- [ 0 10 2 3 4 5 6 7 8 9]
- [ 10 2 3 4 5 6 7 8 9 ]
Answer :
5. What is the output of the following code?

- [2, 3, 4, 5]
- [0, 1, 2, 3]
- [1, 2, 3, 4]
- Will throw an error: Set objects are not iterable.
Answer :
6. What will be the output of the following code snippet?

- {27.5}
- {1, ‘four ‘, 3.0, 3, 5, ‘two ‘, 10, 27.5}
- {1, ‘four ‘, 3.0, 5, ‘two ‘, 10, 27.5}
- {1, ‘four ‘, 3.0, 5, ‘two ‘, 3}
Answer : See Answers
7. Let t1 = (1, 2, “tuple”, 4) and t2 = (5, 6, 7). Which of the following will not give any error after the execution?
- t1.append(5)
- x = t2[t1[1]]
- t3 = t1 + t2
- t3 = (t1, t2)
- t3 = (list(t1), list(t2))
Answer :
8. Let d = {1 : “Pyhton”, 2 : [1, 2, 3]}. Which among the following will not give the error after the execution?
- d[2].append(4)
- x = d[0]
- d[“one”] = 1
- d.update({‘one’ : 2})
Answer :
9. Which of the following data type is immutable?
- list
- set
- tuple
- dictionary
Answer :
10. student = {‘name’: ‘Jane’, ‘age’: 25, ‘courses’: [‘Math’, ‘Statistics’]}
Which among the following will return
{‘name’: ‘Jane’, ‘age’: 26, ‘courses’: [‘Math’, ‘Statistics’], ‘phone’: ‘123-456’}
- student.update({‘age’ : 26})
- student.update({‘age’ : 26, ‘phone’: ‘123-456’})
- student[‘phone’] = ‘123-456’
student.update({‘age’ : 26}) - None of the above
Answer :
11. What is the output of the following code?

- [‘M’, ‘A’, ‘H’, ‘E’, ‘S’, ‘H’]
- [‘m’, ‘a’, ‘h’, ‘e’, ‘s’, ‘h’]
- [‘M’, ‘a’, ‘h’, ‘e’, ‘s’, ‘h’]
- [‘m’, ‘A’, ‘H’, ‘E’, ‘S’, ‘H’]
Answer :
12. What will be the output of the following code snippet?

- [[1 2 3 4 5]
[3 4 5 6 7]
[5 6 7 8 9]] - [[1 2 3 4]
[3 4 5 6]
[5 6 7 8]] - [[2 3 4]
[4 5 6]
[6 7 8]] - None of the above
Answer : See Answers
NPTEL Python for Data Science Week 2 Assignment Answers 2024
1. Which of the following object does not support indexing?
- tuple
- list
- dictionary
- set
Answer :- d
2. Given a NumPy array, arr = np.array([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]), what is the output of the command, print(arr[0][1])?

Answer :- c
3. What is the output of the following code?

- [2, 3, 4, 5]
- [0 1 2 3]
- [1, 2, 3, 4]
- Will throw an error: Set objects are not iterable.
Answer :- c
4. What is the output of the following code?


Answer :- c
5. Which of the following code gives output My friend’s house is in Chennai?

Answer :- a, d
6. Let t1 = (1, 2, “tuple”, 4) and t2 = (5, 6, 7). Which of the following will not give any error after the execution?
- t.append(5)
- x=t2[t1[1]]
- t3=t1+t2
- t3=(t1,t2)
- t3=(list(t1),list(t2))
Answer :- b, c, d, e
7. Let d = {1 : “Pyhton”, 2 : [1, 2, 3]}. Which among the following will not give the error after the execution?
- d[2].append(4)
- x=d[0]
- d[“one”]=1
- d.update(‘one′:2)
Answer :- a, c, d
8. Which of the following data type is immutable?
- list
- set
- tuple
- dictionary
Answer :- c
9. student = {‘name’: ‘Jane’, ‘age’: 25, ‘courses’: [‘Math’, ‘Statistics’]}
Which among the following will return
{‘name’: ‘Jane’, ‘age’: 26, ‘courses’: [‘Math’, ‘Statistics’], ‘phone’: ‘123-456’}
- student.update({‘age’ : 26})
- student.update({‘age’ : 26, ‘phone’: ‘123-456’})
- student[‘phone’] = ‘123-456’student.update({‘age’ : 26})
- None of the above
Answer :- b, c
10. What is the output of the following code?

- [‘M’, ‘A’, ‘H’, ‘E’, ‘S’, ‘H’]
- [‘m’, ‘a’, ‘h’, ‘e’, ‘s’, ‘h’]
- [‘M’, ‘a’, ‘h’, ‘e’, ‘s’, ‘h’]
- [‘m’, ‘A’, ‘H’, ‘E’, ‘S’, ‘H’]
Answer :- a


