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

PPS Python Course Pack-2

Uploaded by

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

PPS Python Course Pack-2

Uploaded by

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

COURSE PACK

SCHEME

The scheme is an overview of work-integrated learning opportunities and gets students out into the real
world. This will give what a course entails.

Course Title Programming for Problem Solving Course Type Comprehensive

Course Code E1UA102C Class BCA


Activity Credits Credit Hours Total Number of Assessment
Classes per Semester in Weightage
Lecture 3 3
Instruction

Practical
Practical
Tutorial 0 0

Tutorial
Theory
delivery

study
Self-

SEE
CIE
Practical 1 2
Self-study 1 3
Total 5 8
45 0 30 45 50% 50%
Course Lead Dr. Shambhu Kumar Jha Course Ms. Kanchan Naithani
Coordinator
Names Theory Practical
Course Shambhu Kumar Jha Shambhu Kumar Jha
Instructors Vinay Diwedi Vinay Diwedi
Shilpi Gupta Shilpi Gupta
Mandeep Kumar Mandeep Kumar
Richa Kumari Richa Kumari
Ravi Sharma Ravi Sharma
Rakhshita Rakhshita
Rajeswari Rajeswari
Rahuk Kumar Rahuk Kumar
Kanchan Kanchan
Neha Singh Neha Singh
Nitin Sondhi Nitin Sondhi

COURSE OVERVIEW

This course brings together the concepts of problem solving skills using Algorithm, Flowchart,
and pseudo code through the Python programming language. After completion of course, the
student will be able to develop Python programs dealing with a wide variety of subject matter
domains. Topics include Programming Life Cycle for Python, Python Environment, , Control
Statements, Lists and Nested List, Tuple, Sets, Functions. Further it extends a Comparison
between Python programming and C programming language. The course is supplemented with
many hands-on labs.
COURSEPACK |
FORMAT
PREREQUISITE COURSE

PREREQUISITE COURSE NO
REQUIRED
If, yes please fill in the Details Prerequisite Prerequisite course name
course code

COURSE OBJECTIVE

1. To understand the concepts of Problem solving skills.


2. To understand and execute the concepts of Python Programming.
3. To apply the concepts of functions, strings, Lists, tuples, dictionaries in python.
4. To implement solutions for different basic and intermediate level problems, which involve
object orientation using python

COURSE OUTCOMES (COs)

CO No. Course Outcomes


102C.1 Understand Problem solving approach using Flow charts, Algorithm and Pseudo
Code
102C.2 Analyze the given problem and use appropriate python program elements to
solve it
102C.3 Develop Python programs involving decisions, loops, functions, and exceptions.
102C.4 Apply data structures like Lists, tuples and dictionaries
102C.5 Apply Object oriented programming approach to create project

BLOOM’S LEVEL OF THE COURSE OUTCOMES


Bloom's taxonomy is a set of hierarchical models used for the classification of educational learning
objectives into levels of complexity and specificity. The learning domains are cognitive, affective, and
psychomotor.

COURSEPACK |
FORMAT
COMPREHENSIVE
Remember Understand Apply Analyse Evaluate Create
CO No.
KL1 KL 2 KL 3 KL 4 KL 2 KL 6
102C.1 √ √ - - - -
102C.2 - √ √ - -
102C.3 - - √ - -
102C.4 - - - - - √
102C.5 - - - - - √

PROGRAM OUTCOMES (POs):

PO1: The program enhances analytics, managerial, communication and computing Application
skills besides inculcating the virtue of self-study.
PO2: Analyze and synthesis computing systems through quantitative and qualitative techniques.
PO3: Design and develop computer programs in the areas related to algorithm, web design,
networking and AI
PO4: Inculcating essential skills are demanded by Indian and Global Software industries through
latest tools of learning. This also includes team-building skills, audio-visual presentations
and personality development programs.
PO5: To develop inter-twining competence in the field of Digital Marketing and Commerce,
Computing Skill and Computational tools.
PO6: To develop practical skills to provide solutions to industry, society and business.
PO7: Understand environmental issues and lead a life with concerns for environment.
PO8: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the computing science practice.
PO9: To make graduates understand cross culture, societal, professional, legal and ethical issues
prevailing in industry.
PO10: Communicate effectively in both verbal and written form.
PO11: To apply standard software engineering practices and strategies in software project
development using open source programming environment to deliver a quality of product
for business success.
PO12: Recognize the need for lifelong learning for continuous enhancement and up graduate of
technological changes in society.

PROGRAM SPECIFIC OUTCOME (PSO): (if any)

PSO1: Have the ability to work with emerging technologies in computing requisite to industry 4.0.
PSO2: Demonstrate the application development skills learned through technical training and
projects to solve real world problems.

COURSEPACK |
FORMAT
COURSE ARTICULATION MATRIX
TheCoursearticulationmatrixindicatesthecorrelationbetweenCourseOutcomesandProgram
Outcomesandtheirexpectedstrengthofmappinginthreelevels(low,medium,andhigh).

COs#/

PSO1

PSO2
PO10

PO11

PO12
POs
PO1

PO2

PO3

PO4

PO5

PO6

PO7

PO8

PO9
102C.1 - - - - - - - - - - - - 1 -
102C.2 2 - - - - - - - - - - - 1 3
102C.3 - 2 - - - 2 - - - - - - 1 -
102C.4 - - 2 - - 2 - - - - 1 - 1 -
102C.5 - 1 2 - - 3 - - - - 1 2 1 -

Note: 1-Low, 2-Medium, 3-High

COURSE ASSESSMENT
The course assessment patterns are the assessment tools used both in formative and summative
examinations.

CIE
Total SEE
Assessment Tools QUIZ 1 QUIZ 2 / MT LAB LAB Course- CIE
/ AAT AAT EXAM based marks
Project

0 0 X X
Comprehensive 50
0 0 25 0 25 100 100

COURSEPACK |
FORMAT
COURSE CONTENT
(THEORY + PRACTICAL)

Topic Content
Introduction to Problem-solving, and Computer: Components, Algorithm,
Flowchart: Elements, Identifying and understanding input/ output, Branching and
iteration in a flowchart, Pseudo Code: Representation of different construct, converting
flowchart from pseudo-code.

Python Program for Problem-Solving: Introduction to Programming Cycle for


Python, Python Environment, Variables, Print function, Operators, Operator
Precedence. Conditional Statements: If, If- else, Nested if-else. Looping: Purpose and
working (For, While, Nested loops). Control Statements: Breakup, and Pass
Comments, Basic testing and debugging.

Lists and Nested List: Introduction, accessing the list, Operations using lists, Library
Function and Methods with Lists. Strings: Introduction, accessing items, Length and
performing Concatenation and Repeat operations, Indexing and Slicing, Library
Functions, and Methods. Tuple: Introduction, Accessing Tuples, Operations, Library
Functions and Methods. Sets: Introduction, Operations, Functions. Difference between
THEORY
set and lists. Dictionaries: Introduction, accessing values in dictionaries, Library
Functions, File: Introduction of txt file and its basic operations.

Functions: Defining a function, calling a function, Types of functions, Function


Arguments, Execution of a Function, Keyword, and Default Arguments, Exception
Handling: Definition, except clause, Try, finally clause, User Defined Exceptions.

C Program for Problem-Solving: Comparison between Python and C, syntax, Data


Types, Expressions, Boolean Expressions, Assignment Statements, Arithmetic
Operators, and Operator Precedence. Conditional Statements: If, If- else, Nested if-
else. Looping: (For, While, Nested loops). Control Statements: Break, and Pass
Comments, define a function, Call a function, Types of functions-examples, Array
handling in C – declaration – single dimensional arrays, two – dimensional arrays,
multi-dimensional arrays.

COURSEPACK |
FORMAT
List of Experiments
EXP1: Develop a program about fundamental Data types in Python
Programming. (i.e., int, float, complex, bool and string types)

Exp-2: Demonstrate the working of following functions in Python.


id () ii) type () iii) range ()

Exp-3: Write a Python program to demonstrate various type conversion


functions.

Exp-4: Demonstrate the following Operators in Python with suitable


examples. i) Arithmetic Operators ii) Relational Operators iii) Assignment
Operator iv) Logical Operators v) Bit wise Operators vi) Ternary Operator
vii) Membership Operators viii) Identity Operators

Exp-5 Write Python programs to demonstrate the following:


i) input () ii) print () iii) ‘sep’ attribute iv) ‘end’ attribute
v) replacement Operator ({ })

Exp-6: Demonstrate the following Conditional statements in Python with


suitable examples. i) if statement ii) if else statement iii) if – elif – else
statement

PRACTICAL Exp-7: Demonstrate the following Iterative statements in Python with


suitable examples. i) while loop ii) for loop

Exp-8: Demonstrate the following control transfer statements in Python with


suitable examples. i) break ii) continue iii) pass

Exp-9: Write a Python program to demonstrate various ways of accessing the


string. i) By using Indexing (Both Positive and Negative) ii) By using Slice
Operator

Exp-10: Demonstrate the following functions/methods which operates on


strings in Python with suitable examples: i) len( ) ii) strip( ) iii) rstrip( ) iv)
lstrip( ) v) find( ) vi) rfind( ) vii) index( ) viii) rindex()

Exp-10: Python program to perform read and write operations on a file.

Exp-11: Python program to compute the number of characters, words and


lines in a file.

Exp-12: Demonstrate the different ways of creating list objects with suitable
example programs

Exp-13: Demonstrate the following functions/methods which operates on

COURSEPACK |
FORMAT
tuples in Python with suitable examples: i) len( ) ii) count( ) iii) index( ) iv)
sorted( ) v) min ( ) vi)max( ) vii) cmp( ) viii) reversed( )
Exp-14: Demonstrate the different ways of creating dictionary objects with
suitable example programs.

Exp-15: Demonstrate the following functions/methods which operates on


dictionary in Python with suitable examples: i) dict( ) ii) len( ) iii) clear( ) iv)
get( ) v) pop( ) vi)popitem( ) vii) keys( ) viii) values() ix) items( ) x) copy( )
xi) update( )

Exp-16: a) Write a Python program to return multiple values at a time using a


return statement.
b) Write a Python program to demonstrate Local and Global variables.
c) Demonstrate lambda functions in Python with suitable example programs

Exp-17: Implement the following Searching and Sorting techniques


i) Linear Search ii) Binary Search iii) Selection Sort iv) Bubble Sort
v) Insertion vi) Merge Sort viii) Quick Sort

Exp-18: Create a child class Bus that will inherit all of the variables and
methods of the Vehicle class

Exp-19: Define a property that must have the same value for every class
instance (object)
Exp-20: Demonstrate the concept of Inheritance.

COURSEPACK |
FORMAT
LESSON PLAN FOR COMPREHENSIVE COURSES
FOR THEORY 15 weeks * 3 Hours = 45 Classes) (1credit = 1 Lecture Hour)
FOR PRACTICAL 15 weeks * 2Hours = 30 Hours lab sessions (1 credit = 2 lab hours)
FOR COURSE - BASED PROJECT 15 weeks * 3 Hours = 45 Hours lab sessions
(1 credit = 3 self-Learning hours) (Not to mention in lesion plan)

Session Topics Skills to be learned


1 Course Introduction: Course Objective ,Evaluation
Criteria ,Course Outcome , Program Outcome
2 Module 1: Introduction to Problem-solving Component
3 Algorithms with Examples,
4 Flowchart: Identifying and understanding input/ output,
Branching and iteration in a flowchart

5 Flowchart with Examples To understand the basic


concept of Problem Solving
Approach
6 Pseudo Code: with example
7 Converting flowchart from pseudo-code.

8 Module 2: Introduction to Programming Cycle for


Python,

9 Python Environment, Variables, Print function,.


10 Operators, Operator Precedence.
11 Conditional Statements: If, If- else, Nested if-else.
12 Examples for Conditional Statements
13 Looping: Purpose and working (For, While, Nested To apply the concepts of
loops. functions, Lists and tuples
14 Examples for Loping in python programming
15 Control Statements: Breakup, and Pass Comments,
16 Examples for Control Statements
17 Basic testing and debugging
18 Revision of Module 1
19 Revision of Module 2

20 Module 3: Lists and Nested List: Introduction, accessing


the list, Operations using lists,

21 Library Function and Methods with Lists.


22 Strings: Introduction, accessing items, Length and
performing Concatenation and Repeat operations,
23 Indexing and Slicing, Library Functions, and Methods.
24 Tuple: Introduction, Accessing Tuples, Operations,
Library Functions and Methods.
25 Sets: Introduction, Operations, Functions. Difference To implement different
COURSEPACK |
FORMAT
between set and lists. concepts of OOPs to
enhance the skill
competency of students
26 Dictionaries: Introduction, accessing values in
dictionaries, Library Functions,
27 File: Introduction of txt file and its basic operations
28 Revision of Module 3
29 Module 4: Functions: Defining a function, calling a
function,
30 Types of functions, Function Arguments,
31 Execution of a Function, Keyword, and Default
Arguments,
32 Examples of Functions
33 Exception Handling: Definition, except clause, Try,
finally clause,
34 User Defined Exceptions.

35 Examples for Exception Handling


36 Revision of Module 4

37 Module 5: C Program for Problem-Solving:

38 Comparison between Python and C, syntax,


39 Data Types, Expressions,
40 Boolean Expressions, Assignment Statements,
Arithmetic Operators, and Operator Precedence.
41 Conditional Statements: If, If- else, Nested if-
else. Looping: (For, While, Nested loops).
42 Control Statements: Break, and Pass Comments, define a
function, Call a function, Types of functions-examples,
43 Array handling in C – declaration – single dimensional
arrays, two – dimensional arrays, multi-dimensional
arrays.
44 Revision of Module 5
45 Overall Revision

COURSEPACK |
FORMAT
LESSON PLAN for PRACTICAL COURSES (15 Lab Classes)

SL. Topics
No.
1 Python program to convert the temperature in degree centigrade to
Fahrenheit

2 Python program to find the area of a triangle whose sides are given
3 Python program to find the circumference and area of a circle with a given
radius

4 Python program to find the geometric mean of n numbers

5 Python program to display th e sum of n numbers using a list.

6 Python program to find out the average of a set of integers

7 Python program to check whether the given number is even or not

8 Python program to find the product of a set of real numbers

9 Python program to check whether the given integer is a multiple of 5

10 Python program to check whether the given integer is a multiple of both 5


and 7

11 Python program to find the average of 10 numbers using while loop

12 Python program to display the given integer in a reverse manner

13 Python program to find the sum of the digits of an integer using a while loop

14 Python program to display all the multiples of 3 within the range 10 to 50

15 Python program to display all integers within the range 100 -200 whose sum
of digits is an even number

COURSEPACK |
FORMAT
16 Python program to check whether the given integer is a prime number or
not

17 Python program to find the roots of a quadratic equation

18 Python program to find the factorial of a number using recursion

19 Python program to find the odd numbers in an array

20 Python program to implement linear search.

21 Python program to implement binary search

22 Python program to find the largest number in a list without using built -in
functions

23 Python program to insert a number to any position in a list

24 Python program to check whether a string is palindrome or not

25 Python program to implement matrix addition

26 Python program to find diagonal elements of a matrix

27 Python program to print all the items in a dictionary

28 Python program to draw a circle of squares using Turtle

29 Python program to implement matrix multiplication

30 Python program to check leap year

COURSEPACK |
FORMAT
BIBLIOGRAPHY
Textbook:
1. The Complete Reference Python, Martin C. Brown, McGraw Hill

2. Head First C: A Brain-Friendly Guide (Greyscale Indian Edition) by David


Griffiths (Author), Dawn Griffiths, O'Reilly Media, Inc.

Other References:
1. Introduction to computing in problem-solving using Python, E Balagurusamy,
McGraw Hill
2. Introduction to programming using Python, Y. Daniel Liang, Pearson
3. Mastering Python, Rick Van Hatten, Packet Publishing House
4. Starting out with Python, Tony Gaddis, Pearson

Swayam/NPTEL/MOOCs:
1. https://onlinecourses.swayam2.ac.in/cec22_cs20/preview
2. https://onlinecourses.nptel.ac.in/noc22_cs32/preview

3. https://onlinecourses.nptel.ac.in/noc19_cs42/preview

WEBLIOGRAPHY
1. https://docs.python.org/3/tutorial/

Optional certifications and online platforms:


1. https://www.codechef.com/practice/python
2. https://skillsforall.com/course/python-essentials-1

PROBLEM-BASED LEARNING
COURSEPACK |
FORMAT
Exercises in Problem-based Learning (Assignments)
SNo Problem KL
1 Write a python program to retrieve strings starting with m, and, end with s having K6
5 characters?

2 Explain Tuples, Lists and Dictionaries with example K6


3 For the following, write the output K6
x = ‘python was developed by abcd and the latest version has been updated’
subx1 = x[0:8]
subx2 = x[19:34]
subx3 = x[6:]
subx4 = x[::2]
subx5 = x[::-1]
print(subx1)
print(subx2)
print(subx3)
print(subx4)
print(subx5)
4 Give the output of following Python code: K6
str1 = ‘This is Pyhton’
print "Slice of String : ", str1[1 : 4 : 1]
print "Slice of String : ", str1[0 : -1 : 2]
5 Write a program to create function calculation () such that it can accept two K6
variables and calculate addition and subtraction. Also, it must return both addition
and subtraction in a single return call.
6 Write a program to use string.format() method to format the following three K6
variables totalMoney = 1000 quantity = 3 price = 450 as per the expected output I
have 1000 dollars so I can buy 3 football for 450.00 dollars.
7 Develop Python program that implements different string testing methods K6
8 Find the LCM of all values of an array where the array contains all integers from 1 K6
to 10
9 Create a class Employee with data members: name, department and salary. Create K6
suitable methods for reading and printing employee information.
10 Develop a program to display all the records in a file “python.txt” along with K6
line/record number?
11 Write a program to find how many times substring “Emma” appears in the K6
given string.

"Emma is good developer. Emma is a writer"


12 Given a two list of numbers, write a program to create a new list such that K6
the new list should contain odd numbers from the first list and even numbers
from the second list.

COURSEPACK |
FORMAT
13 Print the following pattern K6

22

333

4444

5555
14 Use a loop to display elements from a given list present at odd index positions. K6
15 Use python concept to calculate the sum of series up to n term. For example, if n K6
=5 the series will become 2 + 22 + 222 + 2222 + 22222 = 24690
16 • Create an outer function that will accept two parameters, a and b K6
• Create an inner function inside an outer function that will calculate the
addition of a and b
• At last, an outer function will add 5 into addition and return it

17 Given a two Python list. Write a program to iterate both lists simultaneously and K6
display items from list1 in original order and items from list2 in reverse order.
list1 = [10, 20, 30, 40]

list2 = [100, 200, 300, 400]

18 Create a new dictionary by extracting the mentioned keys from the below K6
dictionary.
sample_dict = {
"name": "Kelly",
"age": 25,
"salary": 8000,
"city": "New york"}

# Keys to extract

keys = ["name", "salary"

19 Copy elements 44 and 55 from the following tuple into a new tuple. K6

tuple1 = (11, 22, 33, 44, 55, 66)

COURSEPACK |
FORMAT
20 Create a child class Bus that will inherit all of the variables and methods of the K6
Vehicle class

21 Create a Bus child class that inherits from the Vehicle class. The default fare K6
charge of any vehicle is seating capacity * 100. If Vehicle is Bus instance, we
need to add an extra 10% on full fare as a maintenance charge. So total fare for bus
instance will become the final amount = total fare + 10% of the total fare.

Note: The bus seating capacity is 50. so the final fare amount should be 5500. You
need to override the fare() method of a Vehicle class in Bus class.
22 Given two lists, l1 and l2, write a program to create a third list l3 by picking an K6
odd-index element from the list l1 and even index elements from the list l2.
l1 = [3, 6, 9, 12, 15, 18, 21]

l2 = [4, 8, 12, 16, 20, 24, 28]


23 Slice list into 3 equal chunks and reverse each chunk K6

sample_list = [11, 45, 8, 23, 14, 12, 78, 45, 89]


24 Find the intersection (common) of two sets and remove those elements from the K6
first set

first_set = {23, 42, 65, 57, 78, 83, 29}

second_set = {57, 83, 29, 67, 73, 43, 48}


25 Get all values from the dictionary and add them to a list but don’t add duplicates K6

speed = {'jan': 47, 'feb': 52, 'march': 47, 'April': 44, 'May': 52, 'June': 53, 'july': 54,
'Aug': 44, 'Sept': 54}
26 Write all content of a given file into a new file by skipping line number 5 K6
27 Count all letters, digits, and special symbols from a given string K6

str1 = "P@#yn26at^&i5ve"
28 Given two strings, s1 and s2. Write a program to create a new string s3 made of K6
the first char of s1, then the last char of s2, Next, the second char of s1 and second
last char of s2, and so on. Any leftover chars go at the end of the result.

Given:

s1 = "Abc"

s2 = "Xyz"

COURSEPACK |
FORMAT
Expected Output:

AzbycX
29 Given two .txt files that have lists of numbers in them, find the numbers that are K6
overlapping. One .txt file has a list of all prime numbers under 1000, and the other
.txt file has a list of happy numbers up to 1000.
30 In this challenge, a farmer is asking you to tell him how many legs can be counted K6
among all his animals. The farmer breeds three species:

chickens = 2 legs

cows = 4 legs

pigs = 4 legs

The farmer has counted his animals and he gives you a subtotal for each species.
You have to implement a function that returns the total number of legs of all the
animals.

COURSE-BASED PROJECT (Psychomotor skills)

To enhance their skill set in the integrated course, the students are advised to execute course-based
design projects. Some sample projects are given below:

SNo. Suggested Projects BTL


1 Create a code generator. This can that take text as input, K4

replaces each letter with another letter, and outputs the


“encoded” message.

2 Build a countdown calculator. Write some code that can take K4

two dates as input, and then calculate the amount of time


between them. This will be a great way to familiarize yourself with
Python’s datetime module.

COURSEPACK |
FORMAT
3 Write a sorting method. Given a list, can you write some code K4

that sorts it alphabetically, or numerically? Yes, Python has this


functionality built-in, but see if you can do it without using sort()!
4 Build an interactive quiz. Which Avenger are you? Build a K4

personality or recommendation quiz that asks users some


questions, stores their answers, and then performs some kind of
calculation to give the user a personalized result based on their
answers.
5 Tic-Tac-Toe by Text. Build a Tic-Tac-Toe game that’s playable K4

like a text adventure. Can you make it print a text-based


representation of the board after each move?

6 Make a temperature/measurement converter. Write a script K4

that can convert Fahrenheit to Celcius and back, or inches to


centimetres and back, etc. How far can you take it?
7 Build a counter app. Take your first steps into the world of UI by K4

building a very simple app that counts up by one each time a


user clicks a button.

8 Build a number-guessing game. Think of this as a bit like a text K4


adventure, but with numbers. How far can you take it?
9 Build an alarm clock. This is borderline beginner/intermediate, K4
but it’s worth trying to build an alarm clock for yourself. Can you
create different alarms? A snooze function?
10 Mad Libs Generator is a Python project that will ask you to type K4
words from the different parts of speech. Then create a Python
program that will display a story written from those selected
works.
11 Email Slicer is the easiest but most popular Python project that K4
will have a lot of use in the future. This Python project requires
users to generate a program to retrieve the username and
domain of an email.
COURSEPACK |
FORMAT
12 Rolling Dice Simulation is a Python project that generates a K4
random number each time the program runs. The user can use
the dice as many times as he wants. This Python program will
generate a random number between 1 and 6 when the user rolls
the dice, and then the user will then see the number. It is one of
the interesting Python projects that should be able to randomly
select numbers between 1 and 6 and print them.
13 Rock, Paper, and Scissor K4
It is a very simple Python project based on a popular game
played by children called Rock, Paper, and Scissor. Here, the
first user moves, and then the program makes one. You can use
a single alphabet or input an entire string to indicate the move.
You need to set up a function to check the move’s validity.
15 BMI Calculator with Python K4
The body mass index is calculated by dividing an individual’s
weight in kilograms by their height in meters, then dividing the
answer again by their height

COURSEPACK |
FORMAT

You might also like