2022- NPTEL Python for Data Science Assignment 2 | 100% correct answers with explanation 2022

Опубликовано: 16 Март 2026
на канале: jaganinfo
4,034
42

This video is explained and executed to get the solutions .
Almost 100% accurate answers provided . I have executed in jupyter notebook to verify the result. Subscribe if you gain some information from this useful video.
NPTEL Python for data science Assignment 2 solutions Week 2 .

#nptel #pythonfordatascience #jaganinfo

Coming soon ...
NPTEL Python for data science Assignment 3 solutions Week 3 .

*Note*: _This video is not responsible for any error or mistakes for your assignments.
I have watched the NPTEL course related videos and read the content from different knowledge sources.Almost 100% accurate answers provided . I have executed in jupyter notebook to verify the result_.

Find the solutions\answers in this video for the below questions :

1)Which of the following sequence data type is defined by enclosing the elements in parentheses ‘()’?
2)Which of the following statement is not valid about Numpy ‘Arrays’?
3)The command to access the last element from the array “a” is__
import array as arr
a = arr.array('d', [2.5, 3.5, 4.5])
4)Create an array ‘x’ with values 0 to 9 and find what is the command to extract the elements in the following sequence - array ([5,3,1])?
5)What will be the output after executing the following codes?
x=(0,8,9,15,17,18)
y=slice(1,-2)
6)The method used to increase the length of the list by number of elements in its argument.
7)The function that returns the indices of the sorted elements.
8)Create two tuples
tuple=(2,4,6,3,7)
tuple1=(1,2,3)
Find out which of the following code does not work on a tuple
9)The command to find the number of elements in the following array “N” is
import numpy as np
N=np.array([24, None , 29, 'str', np.nan, 23,20,(),[], ...])
10)Which of the following is not a valid syntax for creating a Set ‘M’ in Python?
M = set([11,12],[13,14],[14,15])
11)What will be the output after executing the following codes?
S={12,13,14,15}
S.intersection_update({17,13,14,16})
print(S)
12)Which of the following command returns the set of all elements from both sets, a and b?
13)What will be the output of ndarray.ndim attribute?
14)For dictionary d = {“plum ":0.66, "pears ":1.25,"oranges ":0.50, “apple”:0.75 }, which of the following statement correctly updates the price of oranges to 0.90?
15)Which of the following command(s) is/are used to join arrays?
16)What will be the output of the dictionary ‘c’?
17)The output of the code given below is
n = [x*x for x in range(4)]
print(n)
18)The output of the code given below is
list = [2, 4, 6, 8]
a = (x**3 for x in list)
print(next(a))
19)Which of the following is not possible in sequence datatypes?
20)Which of the following commands will give you a new numpy array with Boolean values?
NPTEL – PYTHON FOR DATA SCIENCE
ASSIGNMENT 2 – SOLUTION
1. Answer C: Tuples
Tuples is defined by enclosing the elements in parentheses ‘()’

2. Answer B: numpy arrays are immutable
Numpy Arrays are mutable, which means that you can change the value of an element in the array after an array has been initialized.

3. Answer C: print (a[-1])

4. Answer D: x = np.arange(10); x[5::-2]

5. Answer C: 8,9,15

6. Answer C: extend()
extend () is the method used to increase the length of the list by number of elements in its argument.

7. Answer A: np.argsort ()
np.argsort () returns the indices that would sort an array

8. Answer C: tuple[3] = 45
'tuple' object does not support item assignment

9. Answer A: len(N) & C: np.size(N)

10. Answer C: M = set([11,12],[13,14],[14,15])

11. Answer D: S={13,14}

12. Answer A: a | b
Union is performed using | operator in python

13. Answer B: Gives the number of axes or dimensions in the array
ndarray.ndim gives the number of axes or dimensions in the array

14. Answer C: d["oranges "] = 0.90

15. Answer D: all of the above
np.concatenate, np.hstack, and np.vstack help in joining arrays

python for data science,
python for data science nptel,
python for data science nptel assignment solutions,
python for data science nptel assignment 2 solutions,
Python for Data Science Week 2 Assignment 2 answers
Python for Data Science Week 2 solutions,
Python for Data Science Week 2 answers,
python for data science assignment 2 solution,
nptel python for data science week 2 solved,
week 2 solution python for data science,
nptel python for data science,
nptel python for data science assignment answers,
nptel python for data science assignment solutions,
nptel python for data science,
nptel python for data science 2020,
nptel assignment solutions,
#python,#jaganinfo,#datatscience,#nptel,#swayam,

=======================
Subscribe jaganInfo channel to get more related videos
https://www.youtube.com/JAGANINFO?sub...
Thanks for your support to make more videos
=======================