Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
26 views

Python For Data Science - Unit 4 - Week 2 - Assignment

Uploaded by

gopalsharmasml
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Python For Data Science - Unit 4 - Week 2 - Assignment

Uploaded by

gopalsharmasml
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

7/31/24, 7:15 PM Python for Data Science - - Unit 4 - Week 2

(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)

gopalsharmasml@gmail.com 

NPTEL (https://swayam.gov.in/explorer?ncCode=NPTEL) » Python for Data Science (course)

Course Week 2: Assignment 2


outline The due date for submitting this assignment has passed.
Due on 2023-02-08, 23:59 IST.
How does an
NPTEL
online
Assignment submitted on 2023-02-02, 20:01 IST
course 1) What will be the output of the following: 1 point
work? ()

Week 0 ()

Week 1 ()

Week 2 ()

Jupyter setup [[2 6 10]


(unit?
[4 8 12]]
unit=30&lesso
n=31) [[2 4 6]
[8 10 12]]
Sequence_dat
[[2 4]
a_part_1
[6 8]
(unit?
unit=30&lesso [10 12]]
n=32) [[2 8]
[4 10]
Sequence_dat
a_part_2
[6 12]]
(unit? Yes, the answer is correct.
unit=30&lesso Score: 1
n=33) Accepted Answers:
[[2 4 6]
Sequence_dat
[8 10 12]]
a_part_3
(unit?

https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=30&assessment=103 1/4
7/31/24, 7:15 PM Python for Data Science - - Unit 4 - Week 2

unit=30&lesso 2) Let t1 = (1, 2, “tuple”, 4) and t2 = (5, 6, 7). Which of the following will not give any 1 point
n=34) error after the execution?
Sequence_dat
t1.append(5)
a_part_4
(unit? x = t2[t1[1]]
unit=30&lesso t3 = t1 + t2
n=35)
t3 = (t1, t2)
Numpy (unit? t3 = (list(t1), list(t2))
unit=30&lesso
n=36) Yes, the answer is correct.
Score: 1
Week 2 : Accepted Answers:
Lecture slides x = t2[t1[1]]
(unit? t3 = t1 + t2
unit=30&lesso t3 = (t1, t2)
n=37) t3 = (list(t1), list(t2))
Week 2 -
FAQs (unit? 3) Let d1 = {1 : “Pyhton”, 2 : [1, 2, 3]}. Which among the following will not give the error 1 point
unit=30&lesso after the execution?
n=38)
d1[2].append(4)
Practice:
Week 2: x = d1[0]
Practice d1[“one”] = 1
Assignment 2
d1.update({‘one’ : 2})
(assessment?
name=95) Yes, the answer is correct.
Score: 1
Week 2 Accepted Answers:
Feedback d1[2].append(4)
Form : Python d1[“one”] = 1
for Data
d1.update({‘one’ : 2})
Science (unit?
unit=30&lesso
n=99) 4) S1 = {1, 2, 3} 1 point
S2 = {5, 6, 3}
Quiz: Week 2: S1.add(4)
Assignment 2
S2.add(“4”)
(assessment?
name=103)
What will be the output of S1 − S2?
Week 3 ()
{1, 2, 3}

Week 4 () {1, 2, 3, 4}
{1, 2, “4”}
Download {1, 2, 4}
Videos ()
Yes, the answer is correct.
Score: 1
Books () Accepted Answers:
{1, 2, 4}
Text
Transcripts 5) S1 = “Hello” and S2 = “World”. Which of the following will not return “Hello world”? 1 point
()
S1 + “ ” + S2
S1[0 :] + “ ” + S2[0 :]

https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=30&assessment=103 2/4
7/31/24, 7:15 PM Python for Data Science - - Unit 4 - Week 2

“{} {}”.format(S1, S2)


S1[: −1] + “ ” + S2[: −1]

Yes, the answer is correct.


Score: 1
Accepted Answers:
S1[: −1] + “ ” + S2[: −1]

6) Given a NumPy array, arr = np.array([[1, 9, 10], [3, 7, 6], [12, 8, 0]]), find the 1 point
correct command from the following options to get an output array as [16 24 16]?

arr[1: 2]
np.sum(arr, axis = 0)
np.sum(arr, axis = 1)
np.sum([[1, 9, 10], [3, 7, 6], [12, 8, 0]])

Yes, the answer is correct.


Score: 1
Accepted Answers:
np.sum(arr, axis = 0)

7) mat = np.matrix(“5, 9, 10; 2, 5, 4; 1, 9, 8; 2, 6, 8”) 0 points


mat1 = np.matrix(“1, 2, 3, 4”)
mat2 = np.insert(mat, 1, mat1, axis= 1)
print(mat2)

What will be the output of the above command?

[[5 2 1 2]
[1 2 3 4]
[9 5 9 6]]
[10 4 8 8]]
[[1 2 3 4]
[5 2 1 2]
[9 5 9 6]]
[10 4 8 8]]
[[5 1 9 10]
[2 2 5 4]
[1 3 9 8]]
[2 4 6 8]]
It will give an error.

No, the answer is incorrect.


Score: 0
Accepted Answers:
It will give an error.

8) student = {‘name’: ‘Jane’, ‘age’: 25, ‘courses’: [‘Math’, ‘Statistics’]} 1 point


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’})

https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=30&assessment=103 3/4
7/31/24, 7:15 PM Python for Data Science - - Unit 4 - Week 2

student[‘phone’] = ‘123-456’
student.update({‘age’ : 26})
None of the above

Partially Correct.
Score: 0.5
Accepted Answers:
student.update({‘age’ : 26, ‘phone’: ‘123-456’})
student[‘phone’] = ‘123-456’
student.update({‘age’ : 26})

9) c = np.arange(start = 1, stop = 20, step = 3). What is c[5]? 1 point

13
16
15
12

Yes, the answer is correct.


Score: 1
Accepted Answers:
16

10) Which of the following data type is immutable? 1 point

list
set
tuple
dictionary

Yes, the answer is correct.


Score: 1
Accepted Answers:
tuple

https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=30&assessment=103 4/4

You might also like