[go: up one dir, main page]

0% found this document useful (0 votes)
19 views16 pages

Python Lab

lab notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views16 pages

Python Lab

lab notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

2Hindusthan College of Engineering and Technology

An Autonomous Institution Affiliated to Anna University | Approved by AICTE, New Delhi


Accredited with ‘A’ Grade by NAAC |Accredited by NBA (ECE, MECH, EEE, IT & CSE)
Valley Campus, Pollachi Highway, Coimbatore 641 032.| www.hicet.ac.in

Course Information Sheet (CIS)

1. Academic Year : 2022 – 23 EVEN Semester


2. Name of Course Coordinator : P. SANTHANALAKSHMI
3. Department : MASTER OF COMPUTER APPLICATIONS
4. Programme : MCA
5. Class and semester : I Year and Second Semester
6. Course code and title :21CA2001 – PYTHON PROGRAMMING LAB
7. Regulations : R2020
8. Course Category : PC
9. Contact hours : 45
10.Type of course : Practical
11. Credit : 1.5
12. Course Attainment level : 50
13.Course pre-requisites :NIL
13.Course Learning Objectives (CLO) :
1. To develop python programs using control and looping structures.
2. To develop python programs using various data structures, strings, functions,
regular expressions and packages.
3. To develop programs using File handling and exception handling.
4. To develop programs using object oriented programming concepts.
5. To implement the programs using web operations in python.

14. Course Outcomes (COs) :


Upon successful completion of this course, the student will be able to:

CO1 - Develop python programs using control and looping structures.

CO2 - Implement various data structures, strings, functions, regular expressions and packages.

1
CO3 - Develop programs using File handling and exception handling.

CO4 - Implement object-oriented programs concepts in python.

CO5 - Implement web operations in python.

15.Course Syllabus:
LIST OF EXPERIMENTS
Module 1:

Programs on basics of python

1. Install anaconda, pycharm and Jupyter.


2. Use format() method to display the user given input.
3. Implement password validation using conditional checking and branching.
4. Predict the future tuition fees for a university using conditional checking and looping.
5. Implement python calculator using conditional checking with break and continue
statement.
6. Implement movie ticket booking management system in python using functions and
returning values.

Module 2:

Programs on data types in python

1. Create a list with 10 elements


a. Slice first element. b. Slice last element. c. Slice 3rd to 7th element.
d. Index the list. e. Add one element to list. f. Add several elements to list.
2. Create two list
a. Combine two list b. Repeat the list for given number of times.
c. Remove an element from the list. d. Empty the list.

3.Create a tuple named as TUPLE1 with the following items in the


Tuple.
i. TUPLE1 = (‘tupleexample', False, 3.2, 1)
ii. TUPLE2 = tuplex = ("p", "y", "t", "h", "o", "n", "c", "o",“d”,"e")

a. Display the TUPLE 1, TUPLE2 b. Display the 4 th Item from the


TUPLE2 c. Display the 4 th Item from TUPLE2 using Negative Indexing.
d.Check whether the element 3.2 exist in TUPLE1.
e. Convert the List1 = [1,2,3,4,5,6] to a TUPLE.
f. Unpack the TUPLE3 = 4,8,3 into Several variables.
g. Count the frequency of the Item “o” from TUPLE2.
h. Display the length of the TUPLE2.

2
i. Reverse the TUPLE2.

3. Create a dictionary
a. Get a list of all keys. b. Get a list of all values. c. Slice a dictionary.
d. Remove an element from dictionary. e. Clear the dictionary.

4. Do membership test and iterate over the list.


5. Get string input from user. In that string
a. Check for a phrase or a character
b. Check for duplicated words. If there is a duplicate word count on it.
c. Do string strip and string replace operation.
6. Create a module, import it and execute in python.

Module 3:

Programs on File handling and Exception handling

1. Implement file concept in python. In a File do the following file operations:


a. Open a file and read its content.
b. Open a file and write its content to another file.
c. Open a file and append its content.
2. Implement Pickle and unpickle in python.
3. Implement Exception handling in python.
4. Do python code for assertions and logging.
5. Implement custom exceptions.

Module 4:

Programs on Object Oriented Programming.

1. Implement constructor and destructors in python.


2. Use getter and setter method in your program to get and set values from
user.
3. Implement inheritance in python.
4. Implement polymorphism in python.
5. Implement abstract class and interface in python.
Module 5:

Programs on web operations in python.

1. Develop a web application using web forms.


2. Implement the python program to perform various database operations.
3. Implement web scramping.

3
Total Instructional Hours 45
References:
R1 - (For Problems)SeymourLipschutz- Data Structures with C- Schaum’s Outlines-
Special Indian Edition- Tata McGraw-Hill Education (India) Pvt Ltd, Chennai- 20th
reprint 2017.

16.Course plan:

Sl.
No of Cum
No.
Name of the Experiment Hrs Hours

MODULE 1 : BASICS OF PYTHON


1. Install anaconda, pycharm and Jupyter.

2. Use format() method to display the user given input. 2 2

3. Implement password validation using conditional checking and


branching.
1 3

4. Predict the future tuition fees for a university using conditional


checking and looping.
1 4

5. Implement python calculator using conditional checking with break


and continue statement.
2 6

6. Implement movie ticket booking management system in python using


functions and returning values.
3 9

MODULE 2 : DATA TYPES IN PYTHON


7. Create a list with 10 elements 1 10
a.Slice first element. b. Slice last element. c. Slice 3rd to 7th element.
d.Index the list. e. Add one element to list. f. Add several elements

4
to list.

8. Create two list


a.Combine two list b. Repeat the list for given number of times. 1 11
c. Remove an element from the list. d. Empty the list.

9. Create a tuple named as TUPLE1 with the following items in


theTuple.
i TUPLE1 = (‘tupleexample', False, 3.2, 1)
ii TUPLE2 = tuplex = ("p", "y", "t", "h", "o", "n", "c",
"o",“d”,"e") a.Display the TUPLE 1, TUPLE2 b. Display the
4 th Item from the TUPLE2 c. Display the 4 th Item from
TUPLE2 using Negative Indexing. d.Check whether the 1 12
element 3.2 exist in TUPLE1.e.Convert the List1 =
[1,2,3,4,5,6] to a TUPLE. f. unpack the TUPLE3 = 4,8,3 into
Several variables.
g.Count the frequency of the Item “o” from TUPLE2.
h.Display the length of the TUPLE2.
i.Reverse the TUPLE2.
10. Create a dictionary
a.Get a list of all keys. b. Get a list of all values. c. Slice a
dictionary. 2 13

d. Remove an element from dictionary. e. Clear the dictionary

11. Do membership test and iterate over the list. 1 14


12. 5.Get string input from user. In that string
a. Check for a phrase or a character
b. Check for duplicated words. If there is a duplicate word count on 1 15
it.
c. Do string strip and string replace operation

13. Create a module, import it and execute in python. 3 18

MODULE 3 :FILE HANDLING AND EXCEPTION HANDLING IN PYTHON


14. Implement file concept in python. In a File do the following file 1 19
operations:
a.Open a file and read its content.
b.Open a file and write its content to another file.

5
c.Open a file and append its content.

15. Implement Pickle and unpickle in python. 2 21


16. Implement Exception handling in python. 2 23
17. Do python code for assertions and logging. 2 25
18. Implement custom exceptions. 2 27

MODULE 4 :OBJECT-ORIENTED PROGRAMMING IN PYTHON


19. Implement constructor and destructors in python. 1 28
20. Use getter and setter method in your program to get and set values
from user. 2 30

21. Implement inheritance in python. 2 32


22. Implement polymorphism in python. 2 34
23. Implement abstract class and interface in python. 2 36

MODULE 5 :WEB OPERATIONS IN PYTHON


24. Develop a web application using web forms. 3 39
25. Implement the python program to perform various database
operations. 3 42

26. Implement web scramping. 3 45

Total No. of Practical hours: 45


1. Weightage of unit contents:
Factors considered,
F1-Number of periods allotted for teaching the unit and weightage per hour is equal 1
F2 -Usefulnessof the content matter of the unit in the student’s learning point of view and its
weightage equal to 1 if useful otherwise zero.
F3-Usefulness of the content matter of the unit in understanding other units of the same
subjectand its weightage equal to 1 if useful otherwise zero.
F4-Usefulness of the content matter of the unit in understanding other subjects prescribed
for the programme and its weightage equal to 1 if useful otherwise zero.
A1 – Total weightage and A2 – % of Weightage

6
Sl.No Topics F1 F2 F3 F4 A1 A2
1. Install anaconda, pycharm and Jupyter. 1 1 1 0 4 2.86
2. Use format() method to display the user given input. 1 1 1 0 3 2.86

Implement password validation using conditional


3. checking and branching. 1 1 1 1 4 3.82

Predict the future tuition fees for a university using


4. conditional checking and looping. 1 1 1 0 3 2.86

Implement python calculator using conditional


5. 2 1 1 1 5 4.77
checking with break and continue statement
Implement movie ticket booking management
system in python using functions and returning
6. values. 3 1 1 1 6 5.73

Create a list with 10 elements


a.Slice first element. b. Slice last element. c. Slice
7. 3rd to 7th element. d.Index the list. e. Add one 1 1 1 0 3 2.86
element to list. f. Add several elements to list.

Create two list


a.Combine two list b. Repeat the list for given
8. number of times. 1 1 1 0 3 2.86

c. Remove an element from the list. d. Empty the


list.
Create a tuple named as TUPLE1 with the
following items in theTuple.
i TUPLE1 = (‘tupleexample', False, 3.2, 1)
ii TUPLE2 = tuplex = ("p", "y", "t", "h", "o",
"n", "c", "o",“d”,"e") a.Display the TUPLE 1,
TUPLE2 b. Display the 4 th Item from the
TUPLE2 c. Display the 4 th Item from TUPLE2
9. using Negative Indexing. d.Check whether the 1 1 0 0 2 1.91
element 3.2 exist in TUPLE1.e.Convert the
List1 = [1,2,3,4,5,6] to a TUPLE. f. unpack the
TUPLE3 = 4,8,3 into Several variables.
g.Count the frequency of the Item “o” from
TUPLE2.
h.Display the length of the TUPLE2.
i.Reverse the TUPLE2.

7
Sl.No Topics F1 F2 F3 F4 A1 A2
Create a dictionary
a.Get a list of all keys. b. Get a list of all values. c.
10. Slice a dictionary. 2 1 0 0 2 2.86

d. Remove an element from dictionary. e. Clear the


dictionary
11 Do membership test and iterate over the list. 1 1 0 0 2 1.91
Get string input from user. In that string
a. Check for a phrase or a character

12 b. Check for duplicated words. If there is a duplicate 1 1 1 1 4 3.82


word count on it.
c. Do string strip and string replace operation

Create a module, import it and execute in python.


13 3 1 1 0 5 4.77

Implement file concept in python. In a File do the


following file operations:
a.Open a file and read its content.
14 1 1 1 1 4 3.82
b.Open a file and write its content to another file.
c.Open a file and append its content.

15 Implement Pickle and unpickle in python. 2 1 0 0 3 2.86

16 Implement Exception handling in python. 2 1 1 1 5 4.77

17 Do python code for assertions and logging. 2 1 0 0 3 6.82

18 Implement custom exceptions. 2 1 1 1 5 2.86

19 Implement constructor and destructors in python. 1 1 1 1 4 4.77


Use getter and setter method in your program to get
20 and set values from user. 2 1 1 1 5 3.82

21 Implement inheritance in python. 2 1 1 1 5 4.77

22 Implement polymorphism in python. 2 1 1 1 5 4.77

23 Implement abstract class and interface in python. 2 1 1 1 5 4.77

24 Develop a web application using web forms. 3 1 0 1 5 4.77


25 Implement the python program to perform various 3 1 0 1 5 4.77
26 Implement web scramping.
database operations. 3 1 0 1 5 4.77

8
2. Mapping syllabus with Bloom’s Taxonomy LOT and HOT:
Lower Order Thinking
Students are expected to Recall the information through Recognizing,
R Remembering
listing, describing, retrieving, naming, finding
Students are expected to Explain an ideas or concepts through
U Understanding
Interpreting, summarizing, paraphrasing, classifying, explaining
Students are expected to Use the information in another familiar
Ap Applying
situation through Implementing, carrying out, using, executing
Higher Order Thinking
Students are expected to Break the information into parts to explore
A Analyzing understandings and relationships through Comparing, organizing,
deconstructing, interrogating, finding
Students are expected to Evaluate the Justifying a decision or course of
E Evaluating
action through Checking, hypothesizing, experimenting, judging
Students are expected to Generate new ideas, products, or ways of
C Creating viewing things through Designing, constructing, planning, producing,
inventing.

BASICS OF PYTHON(Weightage :22.9 %)


Sl.No Name of the Experiments Process verb Types of thinking
1 Applying
Install anaconda, pycharm and Jupyter. Implement
CO1
2 Use format() method to display the user Creating
given input. Create
CO1
3 Implement password validation using Analysing
conditional checking and branching. Validating
CO1
4 Predict the future tuition fees for a university Analysing
using conditional checking and looping. Predict
CO1
5 Implement python calculator using
conditional checking with break and continue Creating
Implement
statement. CO1

6 Implement movie ticket booking


management system in python using Creating
Implement
functions and returning values CO1

R U Ap A E C Total
Type of thinking in Nos 0 0 1 1 0 4 6

Weightage, % 0 0 3.82 3.82 0 15.26 22.89%


DATA TYPES IN PYTHON(Weightage:20.99%)

9
Create a list with 10 elements
a.Slice first element. b. Slice last element.
c. Slice 3rd to 7thelement.d.Index the list. e. Creating
7 Create
Add one element to list. f. Add several CO2
elements to list.

Create two list


a.Combine two list b. Repeat the list for
Create Creating
8 given number of times.
CO2
c. Remove an element from the list. d.
Empty the list.
Create a tuple named as TUPLE1 with
the following items in theTuple.
i TUPLE1 = (‘tupleexample', False, 3.2,
1)
ii TUPLE2 = tuplex = ("p", "y", "t", "h",
"o", "n", "c", "o",“d”,"e") a.Display the
TUPLE 1, TUPLE2 b. Display the 4 th
Item from the TUPLE2 c. Display the 4 th
Create Creating
9 Item from TUPLE2 using Negative
CO2
Indexing. d.Check whether the element
3.2 exist in TUPLE1.e.Convert the List1
= [1,2,3,4,5,6] to a TUPLE. f. unpack the
TUPLE3 = 4,8,3 into Several variables.
g.Count the frequency of the Item “o”
from TUPLE2.
h.Display the length of the TUPLE2.
i.Reverse the TUPLE2.
Create a dictionary
a.Get a list of all keys. b. Get a list of all
Create Creating
10 values. c. Slice a dictionary.
CO2
d. Remove an element from dictionary. e.
Clear the dictionary
Analysing
11 Do membership test and iterate over the list. Test CO2

12 Get string input from user. In that string Check Analysing


CO2
a. Check for a phrase or a character
b. Check for duplicated words. If there is a

10
duplicate word count on it.
c. Do string strip and string replace operation
Create a module, import it and execute in Create Creating
13
python. CO2
R U Ap A E C Total
Type of thinking in Nos 0 0 0 2 0 5 7
Weightage,% 0 0 0 6 0 14.99 20.99 %
FILE HANDLING AND EXCEPTION HANDLING IN PYTHON(Weightage :22.9%)
14 Implement file concept in python. In a File
do the following file operations:
a.Open a file and read its content. Applying
Implement
b.Open a file and write its content to another CO3
file.
c.Open a file and append its content.
15 Applying
Implement Pickle and unpickle in python. Implement
CO3
16 Applying
Implement Exception handling in python. Implement
CO3
17 Creating
Do python code for assertions and logging. Use
CO3
18 Applying
Implement custom exceptions. Implement
CO3
R U Ap A E C Total
Type of thinking in Nos 0 0 0 4 0 1 5
Weightage,% 0 0 0 15.26 0 3.81 19.76%
OBJECT-ORIENTED PROGRAMMING IN PYTHON(Weightage :22.9%)
14 Implement constructor and destructors in Applying
Implement
python. CO4
15 Use getter and setter method in your program Creating
Use
to get and set values from user. CO4
16 Creating
Implement inheritance in python. Implement
CO4
17 Applying
Implement polymorphism in python. Use
CO4
18 Implement abstract class and interface in Applying
Implement
python. CO4
R U Ap A E C Total
Type of thinking in Nos 0 0 3 0 0 2 5
Weightage,% 0 0 13.74 0 0 9.16 22.9%
WEB OPERATIONS IN PYTHON(Weightage :14.31%)
14 Develop a web application using web forms. Develop Creating

11
CO5
15 Implement the python program to perform Applying
Implement
various database operations. CO5
16 Applying
Implement web scramping.. Implement
CO5
R U Ap A E C Total
Type of thinking in Nos 0 0 2 0 0 1 3
Weightage,% 0 0 9.54 0 0 4.77 14.31%

R U AP A E C TOTAL
BASICS OF PYTHON 0 0.00 3.82 3.82 0 15.26 22.89
DATA TYPES IN
0 0 0 6 0 14.99 20.99
PYTHON
FILE HANDLING
AND EXCEPTION
0 0 0 15.26 0 3.81 19.76
HANDLING IN
PYTHON
OBJECT-ORIENTED
PROGRAMMING IN 0 0 13.74 0 0 9.16 22.9
PYTHON
WEB OPERATIONS
0 0 9.54 0 0 4.77 14.31
IN PYTHON
TOTAL 0 0 27.10 19.08 0 47.99 100.85
Lower Order Thinking 27.10%
Higher Order Thinking 73.08%

12
3. Mapping Course Outcome(COs) with Bloom’s Taxonomy LOT and HOT:
R U Ap A E C
CO1   
CO2  
CO3  
CO4  
CO5  

4. Mapping Course Outcome (CO) with Program Outcomes (PO) :


PO PROGRAM OUTCOME

1. Analyze and synthesize computer fundamentals, computing specialization,


mathematics, and domain knowledge relevant to the computing specialization.
Employ this knowledge to formulate abstract and conceptual computing models,
addressing defined problems and requirements.

2. Examine and address complex computing problems by identifying, formulating,


and researching relevant information. Suggest solutions based on well-supported
conclusions drawn from fundamental principles of math, computer science, and
related fields.

3. Create and assess solutions for intricate computing challenges. Develop and
appraise systems, components, or processes that fulfill specific requirements,
giving careful thought to public health and safety, as well as cultural, societal, and
environmental considerations.

4. Apply research-based knowledge and methods, such as designing experiments,


analysing and interpreting data, and synthesizing information, to generate valid
conclusions.

5. In complex computing tasks, utilize, choose, modify, and employ suitable


techniques, resources, and modern computing tools while recognizing their
limitations.

6 Embrace and adhere to professional ethics, cyber regulations, and the


responsibilities and norms associated with professional computing practice.

7. Demonstrate the capability to pursue self-directed learning for ongoing growth as


a computing professional.

8. Apply computing and management principles effectively in individual work, team


participation, and leadership roles. Manage projects and navigate multidisciplinary
environments as a proficient team member and leader.

9. Convey complex computing activities clearly to the computing community and

13
society. Demonstrate the ability to create informative reports, design
documentation, deliver effective presentations, and give and comprehend clear
instructions.

10. Evaluate societal, environmental, health, safety, legal, and cultural considerations
within both local and global contexts. Recognize the corresponding
responsibilities associated with professional computing practice.

11. Operate proficiently as an individual and as a member or leader in varied teams


and within multidisciplinary environments.

12. Identify a timely opportunity and using innovation to pursue that opportunity to
create value and wealth for the betterment of the individual and society at large.

PO PO PO PO PO PO PO PO PO PO PO PO PO
1 2 3 4 5 6 7 8 9 10 11 12
CO1 3 0 0 1 0 3 1 0 3 1 0 0
CO2 0 3 3 2 3 0 2 3 0 2 3 3
CO3 3 0 0 1 0 3 1 0 3 1 0 0
CO4 0 3 3 2 3 0 2 3 0 2 3 3
CO5 0 3 3 2 3 0 2 3 0 2 3 3

3 High 2 Moderate 1 Low

5. Mapping course with programme educational objectives (PEOs):


Programme Educational Objectives:

Programmeme Educational Objectives

Graduates of the MCA programme will possess a deep understanding of theoretical


foundations and practical applications in computer applications. They will be proficient in
PEO 1 designing, implementing, and managing software solutions that address complex real-
world problems, demonstrating competence in various programming languages and
development methodologies.

MCA graduates will exhibit leadership skills and innovative thinking, enabling them to
lead teams and contribute to the development of cutting-edge IT solutions. They will be
PEO 2 adept at identifying opportunities for technological advancement, applying creative
problem-solving approaches, and adapting to evolving industry trends to address the
dynamic needs of the information technology sector.
Graduates will be socially responsible and ethically conscious professionals, recognizing
PEO 3 the societal impact of technology. They will incorporate ethical considerations in decision-
making processes, demonstrating a commitment to responsible computing practices.
Additionally, they will engage in projects that contribute positively to the community and

14
align with the principles of sustainable development.

PEO1 PEO2 PEO3


CO1, CO2, CO3,
Strongly Moderate
CO4, CO5

Strongly agreed Moderately agreed

6. Course assessment: (Direct Assessment Method)


Record/ Observation Mark: 5 marks
Objective To enhance students' understanding of a particular reading
Product Hand written text/diagramin a record book
Frequency After completing one experiment
Format Each experiment has 5 mark
Evaluation Based on rubrics

Experimental Set up/Execution/Result Mark: 15 marks


Objective Based on the theoretical knowledge setting the experiments- Procedure- circuits –
connection – reading – conclusion & Result
Product Result
Frequency After completing one experiment
Format Each experiment has 15 mark
Evaluation Based on rubrics

ModelLab: 25 Marks
Objective To Identify What Students Have Learned and also to identify students strength and
weakness and to know about experiment
Product Answer scripts
Frequency Once in a semester
Format Total marks = 25
Duration : 2hour and 30 minutes
Evaluation Based on answer given in the scripts / rubrics

Viva-Voce: 5 marks
Objective To measure knowledge, abilities, and/or skills.
Product Questions and answers
Frequency After completing each experiment
Format Objective type questions
Evaluation Based on answer given by students

15
End semester exam: 50 marks
Objective To assess the each student’s knowledge of the course
Product Result analysis
Frequency Semester
Format Aim and Algorithm = 20 marks
Coding & Execution = 50 marks
Result = 15 Marks
Viva-Voce= 15 Marks
Total marks = 100 and this mark is converted to 50 marks
Duration : 3 hours
Evaluation Based on answer given in the scripts
criteria Minimum pass percentage: 50%
If not, remedial action will be taken.

22. Course assessment: (Indirect Assessment Method)


Course Exit Survey: Course Exit Survey consists of few critical questions that evaluate
the level of students’ satisfaction level with curriculum and course being taught.

Prepared by, Checked by,

Course Coordinator Head of the Department


(Mrs.P.SANTHANALAKSHMI)

Approved by,
Dean (Academics) PRINCIPAL

16

You might also like