Page 134 - CatalogNEP-PS
P. 134
13. WAPtoreadafileand
a. Print the total number of characters, words and lines in the file.
b. b. Calculate the frequency of each character in the file. Use a variable of dictionary
type to maintain the count.
c. c. Print the words in reverse order.
d. d. Copy even lines of the file to a file named ‗File1‘ and odd lines to another file
named ‗File2‘.
14. WAPtodefineaclassPointwithcoordinatesxandyasattributes.Createrelevant methods and
print the objects. Also define a method distance to calculate
thedistancebetweenanytwopointobjects.
15. Writeafunctionthatprintsa dictionary where the keys are numbers between 1 and
5andthevaluesarecubes ofthekeys.
16. Consideratuplet1=(1,2,5,7,9,2,4,6,8,10).WAPtoperformfollowingoperations:
a. Printhalfthevaluesofthetupleinonelineandtheotherhalfinthenextline.
b. Printanothertuplewhosevaluesareevennumbersinthegiventuple.
c. Concatenateatuplet2=(11,13,15)witht1.
d. Returnmaximumandminimumvaluefromthistuple
17. WAPtoacceptanamefromauser.Raiseandhandleappropriateexception(s)
ifthetextenteredbytheusercontainsdigitsand/orspecialcharacters.
SUGGUESTED READINGS:
1. Taneja,S.,Kumar,N.PythonProgramming-
AmodularApproach,1stedition,PearsonEducationIndia, 2018.
2. Balaguruswamy E. Introduction to Computing and Problem-Solving using Python,
2ndedition,McGrawHill Education, 2018.
3. Brown,MartinC.Python:TheCompleteReference,2ndedition,McGrawHillEducation, 2018.
4. Guttag,J.V.IntroductiontocomputationandprogrammingusingPython,2ndedition,MITPress,
2016.
Minor III:
Stat.321 Probability and probability distributions 2+1
LEARNING OBJECTIVES:
The primary objective of this course is to introduce:
Probability and statistics to the students.
The concepts of probability and distributions.
LEARNING OUTCOMES:
This course will enable the students to:
Explain the concept of probability and its applications.
Analyze random experiments, sample spaces, events and algebra of events.
Construct random variables, discrete and continuous types, p.m.f., p.d.f., and c.d.f.
Calculate mathematical expectation and generating functions.
Evaluate standard discrete and continuous probability distributions.
119