NPTEL Python For Data Science Week 2 Assignment Answers 2024

Join Our WhatsApp Group Join Now
Join Us On Telegram Join Now

NPTEL Python For Data Science Week 2 Assignment Answers 2024

1. Which of the following oject does not support indexing?

  • tuple
  • list
  • dictionary
  • set
Answer :-  For Answer Click Here

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])?

  • [[1 2 3][4 5 6][7 8 9]]
  • [1 2 3]
  • [4 5 6]
  • [7 8 9]
Answer :-  For Answer Click Here

3. What is the output of the following code?
NPTEL Python For Data Science Week 2 Assignment Answers 2024

  • [2, 3, 4, 5]
  • [0 1 2 3]
  • [1, 2, 3, 4]
  • Will throw an error: Set objects are not iterable.
Answer :-  For Answer Click Here

4. What is the output of the following code?

NPTEL Python For Data Science Week 2 Assignment Answers 2024
NPTEL Python For Data Science Week 2 Assignment Answers 2024
NPTEL Python For Data Science Week 2 Assignment Answers 2024
NPTEL Python For Data Science Week 2 Assignment Answers 2024
NPTEL Python For Data Science Week 2 Assignment Answers 2024
Answer :- 

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

  • place = ‘Chennai” print (“My friend’s house is in {}”. format (place) )
  • place = ‘Chennai” print(‘My friend’s house is in {}’. format (place))
  • print(‘My friend’s house is in {}’. format (place) )
  • print(“My friend’s house is in {}”. format (“Chennai”))
Answer :- 

6. 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=(list(t1),list(t2))
Answer :-  For Answer Click Here

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 :- 

8. Which of the following data type is immutable?

  • list
  • set
  • tuple
  • dictionary
Answer :- 

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 :- 

10. What is the output of the following code?
NPTEL Python For Data Science Week 2 Assignment Answers 2024

  • [‘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 :- For Answer Click Here