SlideShare a Scribd company logo
1 of 4
Download to read offline
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
16.Answer B: { 1: 2, '1': 2 }
17.Answer C: [0, 1, 4, 9]
18.Answer C: 8
19. Which of the following is not possible in sequence datatypes?
Answer B: Create a list inside a set
Create a list inside a set is not possible in sequence datatypes
For eg:
20.Answer D: np.full((3,3),True)

More Related Content

What's hot

Day 2 examples u8f13
Day 2 examples u8f13Day 2 examples u8f13
Day 2 examples u8f13jchartiersjsd
 
Presenter name aizaz ali
Presenter name aizaz aliPresenter name aizaz ali
Presenter name aizaz aliAizazAli21
 
香港六合彩
香港六合彩香港六合彩
香港六合彩baoyin
 
2-Rainbow Domination of Hexagonal Mesh Networks
2-Rainbow Domination of Hexagonal Mesh Networks2-Rainbow Domination of Hexagonal Mesh Networks
2-Rainbow Domination of Hexagonal Mesh Networksijcoa
 
Steering Time-Dependent Estimation of Posteriors with Hyperparameter Indexing...
Steering Time-Dependent Estimation of Posteriors with Hyperparameter Indexing...Steering Time-Dependent Estimation of Posteriors with Hyperparameter Indexing...
Steering Time-Dependent Estimation of Posteriors with Hyperparameter Indexing...Tomonari Masada
 
Javascript Array map method
Javascript Array map methodJavascript Array map method
Javascript Array map methodtanerochris
 
DiffCalculus: September 10, 2012
DiffCalculus: September 10, 2012DiffCalculus: September 10, 2012
DiffCalculus: September 10, 2012Carlos Vázquez
 
Operations With Functions May 25 2009
Operations With Functions May 25 2009Operations With Functions May 25 2009
Operations With Functions May 25 2009ingroy
 
Exercise set 3.7
Exercise set 3.7Exercise set 3.7
Exercise set 3.7math265
 
TreatJS: Higher-Order Contracts for JavaScript
TreatJS: Higher-Order Contracts for JavaScriptTreatJS: Higher-Order Contracts for JavaScript
TreatJS: Higher-Order Contracts for JavaScriptMatthias Keil
 

What's hot (20)

Day 2 examples u8f13
Day 2 examples u8f13Day 2 examples u8f13
Day 2 examples u8f13
 
Day 8b examples
Day 8b examplesDay 8b examples
Day 8b examples
 
Presenter name aizaz ali
Presenter name aizaz aliPresenter name aizaz ali
Presenter name aizaz ali
 
Application of Derivative 7
Application of Derivative 7Application of Derivative 7
Application of Derivative 7
 
Aa4
Aa4Aa4
Aa4
 
8.1
8.18.1
8.1
 
Pc 1.8 notes
Pc 1.8 notesPc 1.8 notes
Pc 1.8 notes
 
Metric k center
Metric k centerMetric k center
Metric k center
 
香港六合彩
香港六合彩香港六合彩
香港六合彩
 
2-Rainbow Domination of Hexagonal Mesh Networks
2-Rainbow Domination of Hexagonal Mesh Networks2-Rainbow Domination of Hexagonal Mesh Networks
2-Rainbow Domination of Hexagonal Mesh Networks
 
Steering Time-Dependent Estimation of Posteriors with Hyperparameter Indexing...
Steering Time-Dependent Estimation of Posteriors with Hyperparameter Indexing...Steering Time-Dependent Estimation of Posteriors with Hyperparameter Indexing...
Steering Time-Dependent Estimation of Posteriors with Hyperparameter Indexing...
 
Ada boosting2
Ada boosting2Ada boosting2
Ada boosting2
 
Javascript Array map method
Javascript Array map methodJavascript Array map method
Javascript Array map method
 
AP Calculus 1984 FRQs
AP Calculus 1984 FRQsAP Calculus 1984 FRQs
AP Calculus 1984 FRQs
 
DiffCalculus: September 10, 2012
DiffCalculus: September 10, 2012DiffCalculus: September 10, 2012
DiffCalculus: September 10, 2012
 
Data structure
Data structureData structure
Data structure
 
Operations With Functions May 25 2009
Operations With Functions May 25 2009Operations With Functions May 25 2009
Operations With Functions May 25 2009
 
1988 FRQs AP Calculus
1988 FRQs AP Calculus1988 FRQs AP Calculus
1988 FRQs AP Calculus
 
Exercise set 3.7
Exercise set 3.7Exercise set 3.7
Exercise set 3.7
 
TreatJS: Higher-Order Contracts for JavaScript
TreatJS: Higher-Order Contracts for JavaScriptTreatJS: Higher-Order Contracts for JavaScript
TreatJS: Higher-Order Contracts for JavaScript
 

Similar to A2 python basics_nptel_pds2_sol

Similar to A2 python basics_nptel_pds2_sol (20)

Topic20Arrays_Part2.ppt
Topic20Arrays_Part2.pptTopic20Arrays_Part2.ppt
Topic20Arrays_Part2.ppt
 
NUMPY-2.pptx
NUMPY-2.pptxNUMPY-2.pptx
NUMPY-2.pptx
 
NUMPY [Autosaved] .pptx
NUMPY [Autosaved]                    .pptxNUMPY [Autosaved]                    .pptx
NUMPY [Autosaved] .pptx
 
Answers withexplanations
Answers withexplanationsAnswers withexplanations
Answers withexplanations
 
Lesson 18-20.pptx
Lesson 18-20.pptxLesson 18-20.pptx
Lesson 18-20.pptx
 
Permutations and Combinations IIT JEE+Olympiad Lecture 4
Permutations and Combinations IIT JEE+Olympiad Lecture 4Permutations and Combinations IIT JEE+Olympiad Lecture 4
Permutations and Combinations IIT JEE+Olympiad Lecture 4
 
CE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfCE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdf
 
NUMPY
NUMPY NUMPY
NUMPY
 
Master the arrays and algorithms using Algotutor
Master the arrays and algorithms using AlgotutorMaster the arrays and algorithms using Algotutor
Master the arrays and algorithms using Algotutor
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
 
Arrays in C Programming
Arrays in C ProgrammingArrays in C Programming
Arrays in C Programming
 
Arrays
ArraysArrays
Arrays
 
Arrays
ArraysArrays
Arrays
 
Arrays and library functions
Arrays and library functionsArrays and library functions
Arrays and library functions
 
Aastha Shah.docx
Aastha Shah.docxAastha Shah.docx
Aastha Shah.docx
 
Computer Science Exam Help
Computer Science Exam Help Computer Science Exam Help
Computer Science Exam Help
 
Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)
 
Introduction to NumPy
Introduction to NumPyIntroduction to NumPy
Introduction to NumPy
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
 
Group p1
Group p1Group p1
Group p1
 

Recently uploaded

Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"John Sobanski
 
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...ThinkInnovation
 
The Significance of Transliteration Enhancing
The Significance of Transliteration EnhancingThe Significance of Transliteration Enhancing
The Significance of Transliteration Enhancingmohamed Elzalabany
 
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...Valters Lauzums
 
obat aborsi Bontang wa 082135199655 jual obat aborsi cytotec asli di Bontang
obat aborsi Bontang wa 082135199655 jual obat aborsi cytotec asli di  Bontangobat aborsi Bontang wa 082135199655 jual obat aborsi cytotec asli di  Bontang
obat aborsi Bontang wa 082135199655 jual obat aborsi cytotec asli di Bontangsiskavia95
 
Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024patrickdtherriault
 
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证zifhagzkk
 
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...Klinik Aborsi
 
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单aqpto5bt
 
原件一样伦敦国王学院毕业证成绩单留信学历认证
原件一样伦敦国王学院毕业证成绩单留信学历认证原件一样伦敦国王学院毕业证成绩单留信学历认证
原件一样伦敦国王学院毕业证成绩单留信学历认证pwgnohujw
 
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证acoha1
 
Bios of leading Astrologers & Researchers
Bios of leading Astrologers & ResearchersBios of leading Astrologers & Researchers
Bios of leading Astrologers & Researchersdarmandersingh4580
 
Genuine love spell caster )! ,+27834335081) Ex lover back permanently in At...
Genuine love spell caster )! ,+27834335081)   Ex lover back permanently in At...Genuine love spell caster )! ,+27834335081)   Ex lover back permanently in At...
Genuine love spell caster )! ,+27834335081) Ex lover back permanently in At...BabaJohn3
 
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...ThinkInnovation
 
1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证
1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证
1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证dq9vz1isj
 
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证pwgnohujw
 
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarjSCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarjadimosmejiaslendon
 
Formulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdfFormulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdfRobertoOcampo24
 
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...yulianti213969
 

Recently uploaded (20)

Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotecAbortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
 
Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"
 
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
 
The Significance of Transliteration Enhancing
The Significance of Transliteration EnhancingThe Significance of Transliteration Enhancing
The Significance of Transliteration Enhancing
 
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
 
obat aborsi Bontang wa 082135199655 jual obat aborsi cytotec asli di Bontang
obat aborsi Bontang wa 082135199655 jual obat aborsi cytotec asli di  Bontangobat aborsi Bontang wa 082135199655 jual obat aborsi cytotec asli di  Bontang
obat aborsi Bontang wa 082135199655 jual obat aborsi cytotec asli di Bontang
 
Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024
 
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
 
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
 
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
 
原件一样伦敦国王学院毕业证成绩单留信学历认证
原件一样伦敦国王学院毕业证成绩单留信学历认证原件一样伦敦国王学院毕业证成绩单留信学历认证
原件一样伦敦国王学院毕业证成绩单留信学历认证
 
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
 
Bios of leading Astrologers & Researchers
Bios of leading Astrologers & ResearchersBios of leading Astrologers & Researchers
Bios of leading Astrologers & Researchers
 
Genuine love spell caster )! ,+27834335081) Ex lover back permanently in At...
Genuine love spell caster )! ,+27834335081)   Ex lover back permanently in At...Genuine love spell caster )! ,+27834335081)   Ex lover back permanently in At...
Genuine love spell caster )! ,+27834335081) Ex lover back permanently in At...
 
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
 
1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证
1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证
1:1原版定制伦敦政治经济学院毕业证(LSE毕业证)成绩单学位证书留信学历认证
 
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
 
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarjSCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
 
Formulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdfFormulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdf
 
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
 

A2 python basics_nptel_pds2_sol

  • 1. 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
  • 2. 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
  • 3. 15.Answer D: all of the above np.concatenate, np.hstack, and np.vstack help in joining arrays 16.Answer B: { 1: 2, '1': 2 } 17.Answer C: [0, 1, 4, 9] 18.Answer C: 8 19. Which of the following is not possible in sequence datatypes? Answer B: Create a list inside a set Create a list inside a set is not possible in sequence datatypes
  • 4. For eg: 20.Answer D: np.full((3,3),True)