Python For Data Science - Unit 4 - Week 2 - Assignment
Python For Data Science - Unit 4 - Week 2 - Assignment
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
gopalsharmasml@gmail.com
Week 0 ()
Week 1 ()
Week 2 ()
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
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]])
[[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.
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})
13
16
15
12
list
set
tuple
dictionary
https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=30&assessment=103 4/4