Python Final Version Course File
Python Final Version Course File
To emerge as a Center of Excellence for producing professionals who shall be the leaders
Mission
M3: To foster networking with Alumni, Industry, Institutes of repute and other stakeholders
M4: To practice and promote high standards of ethical values through societal
commitment.
R22 [Link]. CE (Software Engineering) Syllabus JNTU Hyderabad
I Year I Semester
S. Course Course L T P Credits
No. Code
1. Matrices and Calculus 3 1 0 4
2. Engineering Chemistry 3 1 0 4
3. Programming for Problem Solving 3 0 0 3
4. Basic Electrical Engineering 2 0 0 2
5. Computer Aided Engineering Graphics 1 0 4 3
6. Elements of Computer Science & Engineering 0 0 2 1
7. Engineering Chemistry Laboratory 0 0 2 1
8. Programming for Problem Solving Laboratory 0 0 2 1
9. Basic Electrical Engineering Laboratory 0 0 2 1
Total 12 2 12 20
I Year II Semester
S. Course Course L T P Credits
No. Code
1. Ordinary Differential Equations and Vector Calculus 3 1 0 4
2. Applied Physics 3 1 0 4
3. Engineering Workshop 0 1 3 2.5
4. English for Skill Enhancement 2 0 0 2
5. Electronic Devices and Circuits 2 0 0 2
6. Applied Physics Laboratory 0 0 3 1.5
7. Python Programming Laboratory 0 1 2 2
8. English Language and Communication Skills Laboratory 0 0 2 1
9. IT Workshop 0 0 2 1
Total 10 4 12 20
II YEAR I SEMESTER
Course
S. No. Course Title L T P Credits
Code
1 Digital Electronics 3 0 0 3
2 Data Structures 3 0 0 3
3 Computer Oriented Statistical Methods 3 1 0 4
4 Computer Organization and Architecture 3 0 0 3
5 Object Oriented Programming through Java 3 0 0 3
6 Data Structures Lab 0 0 3 1.5
7 Object Oriented Programming through Java Lab 0 0 3 1.5
8 Gender Sensitization Lab 0 0 2 0
9 Skill Development Course (Data visualization- R 0 0 2 1
Programming/ Power BI)
Total 15 1 10 20
R22 [Link]. CE (Software Engineering) Syllabus JNTU Hyderabad
Course Outcomes: After completion of the course, the student should be able to
● Develop the application specific codes using python.
● Understand Strings, Lists, Tuples and Dictionaries in Python
● Verify programs using modular approach, file I/O, Python standard library
● Implement Digital Systems using Python
Note: The lab experiments will be like the following experiment examples
Week -1:
1. i) Use a web browser to go to the Python website [Link] This page contains information
about Python and links to Python-related pages, and it gives you the ability to search the Python
documentation.
ii) Start the Python interpreter and type help() to start the online help utility.
2. Start a Python interpreter and use it as a Calculator.
3.
i) Write a program to calculate compound interest when principal, rate and number of periods are
given.
ii) Given coordinates (x1, y1), (x2, y2) find the distance between two points
4. Read name, address, email and phone number of a person through keyboard and print the details.
Week - 2:
1. Print the below triangle using for loop.
5
44
333
2222
11111
2. Write a program to check whether the given input is digit or lowercase character or uppercase
character or a special character (use 'if-else-if' ladder)
3. Python Program to Print the Fibonacci sequence using while loop
4. Python program to print all prime numbers in a given interval (use break)
Week - 3:
1. i) Write a program to convert a list and tuple into arrays.
ii) Write a program to find common values between two arrays.
2. Write a function called gcd that takes parameters a and b and returns their greatest common divisor.
3. Write a function called palindrome that takes a string argument and returnsTrue if it is a palindrome
and False otherwise. Remember that you can use the built-in function len to check the length of a string.
Week - 4:
1. Write a function called is_sorted that takes a list as a parameter and returns True if the list is sorted
in ascending order and False otherwise.
2. Write a function called has_duplicates that takes a list and returns True if there is any element that
appears more than once. It should not modify the original list.
R22 [Link]. CE (Software Engineering) Syllabus JNTU Hyderabad
i). Write a function called remove_duplicates that takes a list and returns a new list with only the
unique elements from the original. Hint: they don’t have to be in the same order.
ii). The wordlist I provided, [Link], doesn’t contain single letter words. So you might want to add
“I”, “a”, and the empty string.
iii). Write a python code to read dictionary values from the user. Construct a function to invert its
content. i.e., keys should be values and values should be keys.
3. i) Add a comma between the characters. If the given word is 'Apple', it should become 'A,p,p,l,e'
ii) Remove the given word in all the places in a string?
iii) Write a function that takes a sentence as an input parameter and replaces the first letter of every
word with the corresponding upper case letter and the rest of the letters in the word by
corresponding letters in lower case without using a built-in function?
4. Writes a recursive function that generates all binary strings of n-bit length
Week - 5:
1. i) Write a python program that defines a matrix and prints
ii) Write a python program to perform addition of two square matrices
iii) Write a python program to perform multiplication of two square matrices
2. How do you make a module? Give an example of construction of a module using different geometrical
shapes and operations on them as its functions.
3. Use the structure of exception handling all general purpose exceptions.
Week-6:
1. a. Write a function called draw_rectangle that takes a Canvas and a Rectangle as arguments and
draws a representation of the Rectangle on the Canvas.
b. Add an attribute named color to your Rectangle objects and modify draw_rectangle so that it
uses the color attribute as the fill color.
c. Write a function called draw_point that takes a Canvas and a Point as arguments and draws a
representation of the Point on the Canvas.
d. Define a new class called Circle with appropriate attributes and instantiate a few Circle objects.
Write a function called draw_circle that draws circles on the canvas.
2. Write a Python program to demonstrate the usage of Method Resolution Order (MRO) in multiple
levels of Inheritances.
3. Write a python code to read a phone number and email-id from the user and validate it for
correctness.
Week- 7
1. Write a Python code to merge two given file contents into a third file.
2. Write a Python code to open a given file and construct a function to check for given words present in
it and display on found.
3. Write a Python code to Read text from a text file, find the word with most number of occurrences
4. Write a function that reads a file file1 and displays the number of words, number of vowels, blank
spaces, lower case letters and uppercase letters.
Week - 8:
1. Import numpy, Plotpy and Scipy and explore their functionalities.
2. a) Install NumPy package with pip and explore it.
3. Write a program to implement Digital Logic Gates – AND, OR, NOT, EX-OR
4. Write a program to implement Half Adder, Full Adder, and Parallel Adder
5. Write a GUI program to create a window wizard having two text labels, two text fields and two buttons
as Submit and Reset.
R22 [Link]. CE (Software Engineering) Syllabus JNTU Hyderabad
TEXT BOOKS:
1. Supercharged Python: Take your code to the next level, Overland
2. Learning Python, Mark Lutz, O'reilly
REFERENCE BOOKS:
1. Python Programming: A Modern Approach, Vamsi Kurama, Pearson
2. Python Programming A Modular Approach with Graphics, Database, Mobile, and Web
Applications, Sheetal Taneja, Naveen Kumar, Pearson
3. Programming with Python, A User’s Book, Michael Dawson, Cengage Learning, India Edition
4. Think Python, Allen Downey, Green Tea Press
5. Core Python Programming, W. Chun, Pearson
6. Introduction to Python, Kenneth A. Lambert, Cengage
PROGRAMME OUTCOMES (POs):
2. Problem analysis: Identify, formulate, review research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences, and
engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and design
system components or processes that meet the specified needs with appropriate consideration for the
public health and safety, and the cultural, societal, and environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of
the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in diverse
teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write effective reports and
design documentation, make effective presentations, and give and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the engineering
and management principles and apply these to one‟s own work, as a member and leader in a team, to
manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
PROGRAM SPECIFIC OUTCOMES (PSO's):
A graduate of the Computer Science and Engineering Program will demonstrate:
PSO1: Professional Skills: The ability to understand, analyze and develop computer programs in
the areas related to algorithms ,System Software.
PSO2: Problem-Solving Skills: The ability to apply standard practices and strategies in software
project development to deliver a quality and defect free product .
PSO3: Successful Career and Entrepreneurship: The ability to employ modern computer
languages, techniques in creating innovative career paths to be an entrepreneur, and a zest for
higher studies.
Name of the Programme : [Link] -PPS
CO-PO mapping of the Course
PO1 PO2 PO PO4 PO5 PO6 PO PO PO PO PO PO1 PS PS PS PSO
3 7 8 9 10 11 2 O1 O2 O3 4
Co
standards
other
Seme Cou ur
interaction.
learning process and R&D culture.
a state of art teaching
through societal
investigations of complex problems
highand
Na O
of repute
me
for effective
and promote
ut
technologies.
development of solutions
management andfinance
co
Institutes
Modern tool usage
ethical values
m
Life-long learning
Environment and
Problem analysis
Communication
Individual and
commitment.
stakeholders
To nurture
sustainability
Engineering
e
practice
knowledge
team work
emerging
Industry,
N
Conduct
Design/
Project
society
Ethics
o
To
of
1st PPS CO formulate the algorithms for simple problems 1
3 1
1
CO translate given algorithms to a working and correct program
2
1 3 1
CO correct syntax errors as reported by the compilers
3
1 2 2
CO identify and correct logical errors encountered during execution
4
3 2
CO represent and manipulate data with arrays, strings and structures
5
2 1
CO use pointers of different types
6
1 1
Co create, read and write to and from simple text and binary files
7
2 1
Co modularize the code with functions so that they can be reused
8
2 3 1
TEACHING PLAN
DEPARTMENT: A.Y: 2022-2023
BRANCH: PPL R/SEM: I
TEXT BOOKS:
1. Supercharged Python: Take your code to the next level, Overland
2. Learning Python, Mark Lutz, O'reilly
REFERENCE BOOKS:
1. Python Programming: A Modern Approach, Vamsi Kurama, Pearson
2. Python Programming A Modular Approach with Graphics, Database, Mobile, and Web
Applications, Sheetal Taneja, Naveen Kumar, Pearson
3. Programming with Python, A User’s Book, Michael Dawson, Cengage Learning, India Edition
4. Think Python, Allen Downey, Green Tea Press
5. Core Python Programming, W. Chun, Pearson
6. Introduction to Python, Kenneth A. Lambert, Cengage
MALLAREDDY COLLEGE OF ENGINEERING
Maisammaguda,Dhulapally,Secunderabad
DEPARTMENT OF HUMANITIES & SCIENCES
Name Of The Programme: UG
Distributed List:Department,Library,Lab-In-Charge
Academic Year: 2022-2023 Updated On:
1)Name:
2)Sign:
3)Designation: Date:
Verified By: * For Iqc Only
1)Name: 1)Name:
2)Sign: 2)Sign:
1)Name:
2)Sign: Date:
1
Department of Humanities & Sciences
MALLAREDDY COLLEGE OF ENGINEERING
Maisammaguda,Dhulapally,Secunderabad
VISION OF THE INSTITUTE:
To foster networking with Alumni, Industry, Institutes of repute and other stake holders
for effective interaction.
To practice and promote high standards of ethical values through societal commitment.
Vision
The department aims to become a pioneer in the field of education and training in
Humanities
and Sciences with enriching value added education.
Mission
Department strives to transform its students into Confident, Professionally Sound and
Socially
Responsible Engineers who can meet the challenges of advancing technology and work
for the
betterment of mankind.
2
Program Educational Objectives:
1. Graduates shall have the ability to apply knowledge across the disciplines and in emerging
areas of Computer Science & Engineering for higher studies, research, employability and
handle the realistic problems.
2. Graduates shall have good communication skills, possess ethical conduct, sense of
responsibility to serve the society, and protect the environment.
3. Graduates shall have strong foundation in academic excellence, soft skills, managerial
skills, leadership qualities and understand the need for lifelong learning for a successful
professional career.
Program Outcomes:
PO1:Engineering knowledge: Apply the knowledge of mathematics, science,
engineering fundamentals, and an engineering specialization to the solution of complex
engineering problems.
PO2:Problem analysis: Identify, formulate, review research literature, and analyze
complex engineering problems reaching substantiated conclusions using first principles
of mathematics, natural sciences, and engineering sciences
PO3:Design/development of solutions: Design solutions for complex engineering
problems and design system components or processes that meet the specified needs with
appropriate consideration for the public health and safety, and the cultural, societal, and
environmental considerations.
PO4:Conduct investigations of complex problems: Use research-based knowledge and
research methods including design of experiments, analysis and interpretation of data,
and synthesis of the information to provide valid conclusions.
PO5:Modern tool usage: Create, select, and apply appropriate techniques, resources,
and modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
PO6:The engineer and society: Apply reasoning informed by the contextual knowledge
to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.
PO7:Environment and sustainability: Understand the impact of the professional
3
engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.
PO8:Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
PO9:Individual and team work: Function effectively as an individual, and as a
member or leader in diverse teams, and in multidisciplinary settings.
PO10:Communication: Communicate effectively on complex engineering activities
with the engineering community and with society at large, such as, being able to
comprehend and write effective reports and design documentation, make effective
presentations, and give and receive clear instructions.
PO11:Project management and finance: Demonstrate knowledge and understanding of
the engineering and management principles and apply these to one’s own work, as a
member and leader in a team, to manage projects and in multidisciplinary environments
PO12:Life-long learning: Recognize the need for, and have the preparation and ability
to engage in independent and life-long learning in the broadest context of technological
change.
Program Specific Outcome:
4
Course Structure
Course Objectives:
The students will learn the following:
To work with an IDE to create, edit, compile, run and debug programs
To analyze the various steps in program development.
To develop programs to solve basic problems by understanding basic concepts in C like
operators, control statements etc.
To develop modular, reusable and readable C Programs using the concepts like
functions,
arrays etc.
To write programs using the Dynamic Memory Allocation concept.
To create, read from and write to text and binary files
Course Outcomes
The student is expected to learn from this laboratory course the concept of error and its analysis
It also allows the student to develop experimental skills to design new experiments in
Engineering. With the exposure to these experiments the student can compare with the correlate
with experiment.
CO3. Design the programs involving basic operations, decision structures and looping
structures.
CO4. Explain the need of writing programs using functions and parameter passing
techniques.
5
CO5. Demonstrate the array concepts, structure concepts and dynamic memory allocation
with the help of pointers.
CO6. Use different types of files for reading and writing the data into persistent storage
device and explain the role of simple data structures like stacks, queues
OBJECTIVES:
Competency Indicators
6
1.1 Demonstrate competence in mathematical 1.1.2 Apply advanced mathematical techniques
model to model and solve Engineering problems
1.4 Demonstrate competence in specialized 1.4.1 Apply advanced programming techniques
engineering knowledge to the program to solve Engineering problems
2.1 Demonstrate an ability to identify and 2.1.2 Identify engineering systems
formulate complex engineering problem. ,variables,and parameters to solve the problems
2.1.3 Identify the mathematical ,engineering
and programming knowledge that applies to
the given problem.
2.3 Demonstarte an ability to formulate and 2.3.1 Combine scientific principles and
integrate a model programming concepts to formulate a process
that is appropriate in terms of applicability and
required accuracy
2.3.2 Identify assumptions which are necessary
to allow formulate a sytem at the level of
accuracy required.
2.4 Demonstrate an ability to execute a 2.4.4. extract desired understanding and
solution process and analyze results conclusions consistent with objectives and
limitations of the analysis.
3.2 Demonstrate an ability to generate a 3.2.2. build models prototypes to develop a
diverse set of alternative design solutions diverse set of design solutions.
3.2.3. Identify suitable criteria for the
evaluation of alternative design solutions.
3.4 Demonstrate an ability to advance an 3.4.1 Refine a conceptual design into a detail
engineering design to defined state. design within the existing constraints (of the
resources).
3.4.2 Generate information through appropriate
test cases to improve or revise the design
4.1 Demonstrate an ability to conduct 4.1.3 Examine relevant models ,tools and
investigations of technical issues consistent techniques of program design ,analysis and
with their level of knowledge and presentation .
understanding 4.1.4 Establish a relationship between desired
date and underlying physical data.
8.1 Demonstrate an ability to recognize ethical 8.1.1 Identify situations of unethical
dilemmas professional conduct and propose ethical
alternatives.
9.1 Demonstrate an ability to form a team and 9.1.1 Recognize a variety of working and
define a role for each member learning preferences appreciate the value of
diversity on a team.
9.1.2 Implement the norms of practice (e.g role
,rules ,charters ,agendas ) for effective team
work to accomplish the goal.
7
SCHEME OF EVALUATION
Total Marks For Each Student to Evaluate In Lab :100 Marks
RUBRICS
Key 4-very good 3-good 2-fair 1- Need to
performance improve
Criteria(kpc)
(25pts)
Problem The thorough The better The basic The partial
statement(2) knowledge of knowledge of knowledge of knowledge of
problem problem problem problem statement(3)
statement(3) statement(2) statement(2)
Experimental The The The experimental The experimental
procedure experimental experimental procedure is procedure is
(Algorithm/Fl procedure is procedure is explained clearly explained some minor
owchart/tools explained with explained and the few implementation
Description the relevant clearly and details are details are missing
8
and implementation the details are covered with with Simulation(2)
Simulation(5) of Tool covered with Simulation(3)
Simulation(5) Simulation(4)
Test Cases Produces correct Produces Produces correct Produces wrong
Verificaton(3) output for all correct output output forfew output for most of the
mentioned test for majority important test cases in
cases correctly in of test cases possible test implementation/simul
implementation/s corre ctly in cases correctly in ation(1)
imulation(3) implementatio implementation/si
n/simulation(3 mulation(3)
)
Oral In depth Good Basic knowledge With basic
Presentation/ knowledge on knowledge on on the concept knowledge on the
Viva(5) the concept and the concept and answered few concept and answered
answered all the and answered of the few of the
questions(4) all the questions(2) questions(2)
questions(4)
Presentation/d Presented Presented Presented submitted
ocumentation accurately all the accurately all documents in a documents in
based on prescribed the required readable manner ambiguity and not on
record/code of documentation documentatio but not so neatly time with least code
conduct(10) on time with n on time as .s ubmitted of conduct(7)
good code of per the documentation on
conduct(10) prescribed time with
format good reminders trying
code of to adopt good
conduct(9) code of
conduct(8)
9
LIST OF EQUIPMENTS IN
PROGRAMMING FOR PROBLEM
SOLUTION LABORATORY
Dell
Desktop
1 Intel I3@[Link],8gb, 64 PPL LAB-1
Systems
Keyboard,Mouse
Lennovo
Desktop Pentium
2 64 PPL LAB-2
Systems @3.20ghz,2gb
Keyboard,Mouse
These are the instructions for the students attending the lab:
Before entering the lab the student should carry the following things (MANDATORY)
1. Identity card issued by the college.
2. Class notes
3. Lab observation book
4. Lab Manual
5. Lab Record
Student must sign in and sign out in the register provided when attending
the lab session without fail.
Come to the laboratory in time. Students, who are late more than 15 min.,
will not be allowed to attend the lab.
Students need to maintain 100% attendance in lab if not a strict action will be taken.
All students must follow a Dress Code while in the laboratory
Foods, drinks are NOT allowed.
All bags must be left at the indicated place.
10
Refer to the lab staff if you need any help in using the lab.
Respect the laboratory and its other users.
Workspace must be kept clean and tidy after experiment is completed.
Read the Manual carefully before coming to the laboratory and be sure about
what you are supposed to do.
Do the experiments as per the instructions given in the manual.
Copy all the programs to observation which are taught in class before
attending the lab session.
Students are not permitted to use phones, Flash drives, Internet without
permission of lab-in charge.
Lab records need to be submitted on or before the date of submission.
PYTHON PROGRAMMING LABORATORY
11
To learn control structures.
To Understand Lists, Dictionaries in python
To Handle Strings and Files in Python
Course Outcomes: After completion of the course, the student should be able to
● Develop the application specific codes using python.
● Understand Strings, Lists, Tuples and Dictionaries in Python
● Verify programs using modular approach, file I/O, Python standard library
● Implement Digital Systems using Python
Note: The lab experiments will be like the following experiment examples
Week -1:
1. i) Use a web browser to go to the Python website [Link] This page contains information
about Python and links to Python-related pages, and it gives you the ability to search the Python
documentation.
ii) Start the Python interpreter and type help() to start the online help utility.
2. Start a Python interpreter and use it as a
Calculator.3.
i) Write a program to calculate compound interest when principal, rate and number of periods are
given.
ii) Given coordinates (x1, y1), (x2, y2) find the distance between two points
4. Read name, address, email and phone number of a person through keyboard and print the
details.
Week - 2:
1. Print the below triangle using for
loop.5
44
333
2222
11111
2. Write a program to check whether the given input is digit or lowercase character or uppercase
character or a special character (use 'if-else-if' ladder)
3. Python Program to Print the Fibonacci sequence using while loop
4. Python program to print all prime numbers in a given interval (use break)
Week - 3:
1. i) Write a program to convert a list and tuple into arrays.
ii) Write a program to find common values between two arrays.
2. Write a function called gcd that takes parameters a and b and returns their greatest common divisor.
3. Write a function called palindrome that takes a string argument and returnsTrue if it is a palindrome
and False otherwise. Remember that you can use the built-in function len to check the length of a string.
12
Week - 4:
1. Write a function called is_sorted that takes a list as a parameter and returns True if the list is sortedin
ascending order and False otherwise.
2. Write a function called has_duplicates that takes a list and returns True if there is any element that
appears more than once. It should not modify the original list.
i). Write a function called remove_duplicates that takes a list and returns a new list with only the
unique elements from the original. Hint: they don’t have to be in the same order.
ii). The wordlist I provided, [Link], doesn’t contain single letter words. So you might want to
add“I”, “a”, and the empty string.
iii). Write a python code to read dictionary values from the user. Construct a function to invert its
content. i.e., keys should be values and values should be keys.
3. i) Add a comma between the characters. If the given word is 'Apple', it should become 'A,p,p,l,e'
ii) Remove the given word in all the places in a string?
iii) Write a function that takes a sentence as an input parameter and replaces the first letter of every
word with the corresponding upper case letter and the rest of the letters in the word by
corresponding letters in lower case without using a built-in function?
4. Writes a recursive function that generates all binary strings of n-bit length
Week - 5:
1. i) Write a python program that defines a matrix and prints
ii) Write a python program to perform addition of two square matrices
iii) Write a python program to perform multiplication of two square matrices
2. How do you make a module? Give an example of construction of a module using different geometrical
shapes and operations on them as its functions.
3. Use the structure of exception handling all general purpose exceptions.
Week-6:
1. a. Write a function called draw_rectangle that takes a Canvas and a Rectangle as arguments and
draws a representation of the Rectangle on the Canvas.
b. Add an attribute named color to your Rectangle objects and modify draw_rectangle so that it
uses the color attribute as the fill color.
c. Write a function called draw_point that takes a Canvas and a Point as arguments and draws a
representation of the Point on the Canvas.
d. Define a new class called Circle with appropriate attributes and instantiate a few Circle objects.
Write a function called draw_circle that draws circles on the canvas.
2. Write a Python program to demonstrate the usage of Method Resolution Order (MRO) in multiple
levels of Inheritances.
3. Write a python code to read a phone number and email-id from the user and validate it for
correctness.
Week- 7
1. Write a Python code to merge two given file contents into a third file.
2. Write a Python code to open a given file and construct a function to check for given words present init
and display on found.
3. Write a Python code to Read text from a text file, find the word with most number of occurrences
4. Write a function that reads a file file1 and displays the number of words, number of vowels, blank
spaces, lower case letters and uppercase letters.
13
Week - 8:
1. Import numpy, Plotpy and Scipy and explore their functionalities.
2. a) Install NumPy package with pip and explore it.
3. Write a program to implement Digital Logic Gates – AND, OR, NOT, EX-OR
4. Write a program to implement Half Adder, Full Adder, and Parallel Adder
5. Write a GUI program to create a window wizard having two text labels, two text fields and two buttons
as Submit and Reset.
INTERNAL (DAY TO DAY) EVALUATION METHODOLOGY:
Program Analysis,
(Communication,Lif
Algorithm,Flowchar
Result&Conclusion
KnowledgeGained
eLonglearning)
VIVA VOCE
t,program
ExperimentName
Execution
[Link]
Design
TOTAL
2 4 2 2 5 15
Week -1:
1.i) Use a web browser to go to the
Python website [Link] This
page contains information about
Python and links to Python-related
pages, and it gives you the ability to
search the Python documentation.
[Link]) Start the Python interpreter and type help()
1
to start the online help utility.
[Link] a Python interpreter and use it as a
Calculator.3.
[Link] a program to calculate compound
interest when principal, rate and number of
periods aregiven.
Given coordinates (x1, y1), (x2, y2) find the
distance between two points
Read name, address, email and phone number of
a person through keyboard and print the details.
Week - 2:
Print the below triangle using for loop. 5
44
2 333
2222
11111
Write a program to check whether the
given input is digit or lowercase character
14
or uppercasecharacter or a special character
(use 'if-else-if' ladder)
Python Program to Print the Fibonacci
sequence using while loop
Python program to print all prime numbers
in a given interval (use break)
Week-3:
i) Write a program to convert a list and tuple
into arrays.
ii) Write a program to find common values
between two arrays.
Write a function called gcd that takes
3 parameters a and b and returns their greatest
common divisor.
Write a function called palindrome that
takes a string argument and returnsTrue if it
is a palindromeand False otherwise.
Remember that you can use the built-in
function len to check the length of a string.
Week - 4:
Write a function called is_sorted that takes a list
as a parameter and returns True if the list is
sortedin ascending order and False otherwise.
Write a function called has_duplicates that takes
a list and returns True if there is any element
thatappears more than once. It should not modify
the original list. Write a function called
remove_duplicates that takes a list and
returns a new list with only theunique
elements from the original. Hint: they don’t
have to be in the same order.
The wordlist I provided, [Link], doesn’t
contain single letter words. So you might
want to add“I”, “a”, and the empty string.
4 Write a python code to read dictionary
values from the user. Construct a function
to invert itscontent. i.e., keys should be
values and values should be keys.
i) Add a comma between the characters. If
the given word is 'Apple', it should become
'A,p,p,l,e'
Remove the given word in all the places in a
string?
Write a function that takes a sentence as an
input parameter and replaces the first letter
of everyword with the corresponding upper
case letter and the rest of the letters in the
word by corresponding letters in lower case
without using a built-in function?
Writes a recursive function that generates all
15
binary strings of n-bit length
Week - 5:
i) Write a python program that defines a matrix
and prints
Write a python program to perform addition of
two square matrices
Write a python program to perform
5 multiplication of two square matrices
How do you make a module? Give an example of
construction of a module using different
geometricalshapes and operations on them as its
functions.
Use the structure of exception handling all
general purpose exceptions.
Week-6:
a. Write a function called draw_rectangle that
takes a Canvas and a Rectangle as arguments
anddraws a representation of the Rectangle on
the Canvas.
Add an attribute named color to your Rectangle
objects and modify draw_rectangle so that it
uses the color attribute as the fill color.
Write a function called draw_point that takes a
Canvas and a Point as arguments and draws a
representation of the Point on the Canvas.
6
Define a new class called Circle with appropriate
attributes and instantiate a few Circle objects.
Write a function called draw_circle that draws
circles on the canvas.
Write a Python program to demonstrate the
usage of Method Resolution Order (MRO) in
multiplelevels of Inheritances.
Write a python code to read a phone number
and email-id from the user and validate it for
correctness.
Week- 7
Write a Python code to merge two given file
contents into a third file.
Write a Python code to open a given file and
construct a function to check for given words
present init and display on found.
7 Write a Python code to Read text from a text file,
find the word with most number of occurrences
Write a function that reads a file file1 and
displays the number of words, number of
vowels, blankspaces, lower case letters and
uppercase letters.
Week - 8:
8 [Link] numpy, Plotpy and Scipy and
explore their functionalities.
16
2.a) Install NumPy package with pip and
explore it.
[Link] a program to implement Digital
Logic Gates – AND, OR, NOT, EX-OR
[Link] a program to implement Half
Adder, Full Adder, and Parallel Adder
[Link] a GUI program to create a
window wizard having two text
labels, two text fields and two
buttonsas Submit and Reset.
INDEX
17
Week -1:
i) Use a web browser to go to the Python website [Link] This page contains
information about Python and links to Python-related pages, and it gives you the ability to
search the Python documentation.
ii) Start the Python interpreter and type help() to start the online help utility.
1 Start a Python interpreter and use
it as a Calculator.3.
iii) Write a program to calculate compound interest when principal, rate and number of
periods aregiven.
iv) Given coordinates (x1, y1), (x2, y2) find the distance between two points
Read name, address, email and phone number of a person through keyboard and print the details.
Week - 2:
Print the below
triangle using for
loop.5
44
333
2
2222
11111
Write a program to check whether the given input is digit or lowercase character or
uppercasecharacter or a special character (use 'if-else-if' ladder)
Python Program to Print the Fibonacci sequence using while loop
Python program to print all prime numbers in a given interval (use break)
Week - 3:
i) Write a program to convert a list and tuple into arrays.
3 ii) Write a program to find common values between two arrays.
Write a function called gcd that takes parameters a and b and returns their greatest common divisor.
Write a function called palindrome that takes a string argument and returnsTrue if it is a palindromeand
False otherwise. Remember that you can use the built-in function len to check the length of a string
Week - 4:
Write a function called is_sorted that takes a list as a parameter and returns True if the list is sortedin
ascending order and False otherwise.
Write a function called has_duplicates that takes a list and returns True if there is any element that
appears more than once. It should not modify the original list.
Write a function called remove_duplicates that takes a list and returns a new list with only theunique
elements from the original. Hint: they don’t have to be in the same order.
The wordlist I provided, [Link], doesn’t contain single letter words. So you might want to add“I”, “a”,
and the empty string.
4 Write a python code to read dictionary values from the user. Construct a function to invert itscontent.
i.e., keys should be values and values should be keys.
i) Add a comma between the characters. If the given word is 'Apple', it should become 'A,p,p,l,e'
Remove the given word in all the places in a string?
Write a function that takes a sentence as an input parameter and replaces the first letter of everyword with
the corresponding upper case letter and the rest of the letters in the word by corresponding letters in lower
case without using a built-in function?
Writes a recursive function that generates all binary strings of n-bit length
18
Week - 5:
i) Write a python program that defines a matrix and prints
Write a python program to perform addition of two square matrices
Write a python program to perform multiplication of two square matrices
5 How do you make a module? Give an example of construction of a module using different geometrical
shapes and operations on them as its functions.
Use the structure of exception handling all general purpose exceptions.
Week-6:
a. Write a function called draw_rectangle that takes a Canvas and a Rectangle as arguments anddraws a
representation of the Rectangle on the Canvas.
Add an attribute named color to your Rectangle objects and modify draw_rectangle so that ituses the
color attribute as the fill color.
Write a function called draw_point that takes a Canvas and a Point as arguments and draws a
6 representation of the Point on the Canvas.
Define a new class called Circle with appropriate attributes and instantiate a few Circle [Link] a
function called draw_circle that draws circles on the canvas.
Write a Python program to demonstrate the usage of Method Resolution Order (MRO) in multiplelevels
of Inheritances.
Write a python code to read a phone number and email-id from the user and validate it for
correctness
Week- 7
Write a Python code to merge two given file contents into a third file.
Write a Python code to open a given file and construct a function to check for given words present init and
display on found.
7 Write a Python code to Read text from a text file, find the word with most number of occurrences
Write a function that reads a file file1 and displays the number of words, number of vowels, blank
spaces, lower case letters and uppercase letters.
Week - 8:
Import numpy, Plotpy and Scipy and explore their functionalities.
a) Install NumPy package with pip and explore it.
Write a program to implement Digital Logic Gates – AND, OR, NOT, EX-OR
8 Write a program to implement Half Adder, Full Adder, and Parallel Adder
Write a GUI program to create a window wizard having two text labels, two text fields and two buttonsas
Submit and Reset.
19
INTRODUCTION TO COMPUTERS
Program:
CI = Amount - principal
# Driver Code
20
#Function Call
compound_interest(principal,rate,time)
Input:
Enter the principal amount: 3000
Enter rate of interest: 5
Enter time in years: 3
Output:
Compound interest is 472.875
21
[Link]: Given coordinates (x1, y1), (x2, y2) find the distance between two
points.
Program:
x1=int(input("enter x1 : "))
x2=int(input("enter x2 : "))
y1=int(input("enter y1 : "))
y2=int(input("enter y2 : "))
Output :
enter x1 : 4
enter x2 : 6
enter y1 : 0
enter y2 : 6
22
[Link]: Read name, address, email and phone number of a person through
keyboard and print the details.
Program:
def personal_details():
name, age = "Simon", 19
address = "Bangalore, Karnataka, India"
print("Name: {}\nAge: {}\nAddress: {}".format(name, age, address))
personal_details()
OUTPUT:
Name: Simon
Age: 19
Address: Bangalore, Karnataka, India
23
4. Aim: Print the below triangle using for loop.
Program:
rows = 6
# if you want user to enter a number, uncomment the below line
# rows = int(input('Enter the number of rows'))
# outer loop
for i in range(rows):
# nested loop
for j in range(i):
# display number
print(i, end=' ')
# new line after each row
print('')
OUTPUT:
22
333
4444
55555
[Link]: Write a program to check whether the given input is digit or lowercase
24
character or uppercase character or a special character (use 'if-else-if' ladder).
Program:
ch = input("Please Enter Your Own Character : ")
else:
print("The Given Character ", ch, "is Not a Lower or Uppercase Alphabet")
OUTPUT:
>>>
>>>
25
[Link]: Python Program to Print the Fibonacci sequence using while loop.
Program:
Number = int(input("\nPlease Enter the Range : "))
# Initializing First and Second Values
i=0
First_Value = 0
Second_Value = 1
# Find & Displaying
while(i < Number):
if(i <= 1):
Next = i
else:
Next = First_Value + Second_Value
First_Value = Second_Value
Second_Value = Next
print(Next)
i=i+1
OUTPUT:
26
7. Aim: Python program to print all prime numbers in a given interval (use
break).
Program:
def primenumber(MyNum):
n=0
i=2
for i in range(2,MyNum//2+1):
if MyNum % i == 0:
n=n+1
break
if n == 0:
print(MyNum, end=" ")
x = 50
print("Prime numbers less than", x, "are:")
for i in range(2, x+1):
primenumber(i)
OUTPUT:
27
[Link]:
i) Write a program to convert a list and tuple into arrays.
Program:
def convert(list):
return tuple(i for i in list)
# Driver function
list = [1, 2, 3, 4]
print(convert(list))
OUTPUT:
(1, 2, 3, 4)
28
Aim:
ii) Write a program to find common values between two arrays.
Program:
array1 = [1, 2, 3, 4, 5]
array2 = [4, 5, 6, 7, 8]
OUTPUT:
The common values between the two arrays are: [4, 5]
29
[Link]: Write a function called gcd that takes parameters a and b and returns
their greatest common divisor.
Program:
Output:
30
10. Aim: Write a function called palindrome that takes a string argument and
returnsTrue if it is a palindrome and False otherwise. Remember that you can
use the built-in function len to check the length of a string.
Program:
if(string == revstr):
print("The string is a palindrome.")
else:
print("The string is not a palindrome.")
OUTPUT:
31
11. Aim: Write a function called is_sorted that takes a list as a parameter and
returns True if the list is sorted in ascending order and False otherwise.
Program:
# printing result
if (not flag) :
print ("Yes, List is sorted.")
else :
print ("No, List is not sorted.")
Output :
Original list : [1, 4, 5, 8, 10]
Yes, List is sorted.
32
[Link]: Write a function called has_duplicates that takes a list and returns
True if there is any element that appears more than once. It should not modify
the original list.
i). Write a function called remove_duplicates that takes a list and returns a new
list with only the bunique elements from the original. Hint: they don’t have to
be in the same order.
Program:
def Remove(duplicate):
final_list = []
for num in duplicate:
if num not in final_list:
final_list.append(num)
return final_list
# Driver Code
duplicate = [2, 4, 10, 20, 5, 2, 20, 4]
print(Remove(duplicate))
Output:
[2, 4, 10, 20, 5]
33
ii).
Aim: Write a python code to read dictionary values from the user. Construct a
function to invert its content. i.e., keys should be values and values should be
keys.
Program:
def invert_dict(d):
inverse = {}
for key in d:
val = d[key]
if val not in inverse:
inverse[val] = [key]
else:
inverse[val].append(key)
return inverse
OUTPUT:
Enter key (or 'q' to stop): 22
Enter value: "ram"
Enter key (or 'q' to stop): 34
Enter value: "sita"
Enter key (or 'q' to stop): 54
Enter value: "mahesh"
Enter key (or 'q' to stop): q
Original dictionary:
{'22': '"ram"', '34': '"sita"', '54': '"mahesh"'}
Inverted dictionary:
{'"ram"': ['22'], '"sita"': ['34'], '"mahesh"': ['54']}
34
13.
Aim:
i) Add a comma between the characters. If the given word is 'Apple', it should
become 'A,p,p,l,e'
Program:
def add_comma(word):
comma_word = ','.join(word)
return comma_word
# calling function
add_comma("apple")
OUTPUT:
a,p,p,l,e
35
Aim:
ii) Remove the given word in all the places in a string?
Program:
OUTPUT:
This is a string. This is only a .
36
Aim:
iii) Write a function that takes a sentence as an input parameter and replaces
the first letter of every word with the corresponding upper case letter and the
rest of the letters in the word by corresponding letters in lower case without
using a built-in function?
Program:
def title_case(sentence):
# Split the sentence into words
words = [Link]()
# Iterate over the words and apply the title case transformation
for i in range(len(words)):
word = words[i]
# Extract the first letter and convert it to upper case
first_letter = word[0].upper()
# Extract the rest of the letters and convert them to lower case
rest_letters = word[1:].lower()
# Concatenate the first letter and the rest of the letters
words[i] = first_letter + rest_letters
# calling a function
sentence = "I am learning python in Malla Reddy College of Engineering for wo
men"
title_case(sentence)
OUTPUT:
I Am Learning Python In Malla Reddy College Of Engineering For Women
37
14.
Aim: Writes a recursive function that generates all binary strings of n-bit
length.
Program:
print()
OUTPUT:
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
38
15.
Aim:
i) Write a python program that defines a matrix and prints.
Program:
Output:
Enter the number of rows:2
Enter the number of columns:3
Enter the entries rowwise:
1
2
3
4
5
6
123
456
39
Aim:
ii) Write a python program to perform addition of two square matrices.
Program:
X = [[1,2,3],
[4 ,5,6],
[7 ,8,9]]
Y = [[9,8,7],
[6,5,4],
[3,2,1]]
for r in result:
print(r)
Output
[10, 10, 10]
[10, 10, 10]
[10, 10, 10]
40
Aim:
iii) Write a python program to perform multiplication of two square
matrices.
Program:
# iterating by row of A
for i in range(len(A)):
# iterating by column by B
for j in range(len(B[0])):
# iterating by rows of B
for k in range(len(B)):
result[i][j] += A[i][k] * B[k][j]
for r in result:
print(r)
Output:
[114, 160, 60, 27]
[74, 97, 73, 14]
[119, 157, 112, 23]
41
16.
Aim: How do you make a module? Give an example of construction of a
module using different geometrical shapes and operations on them as its
functions.
Program:
import shapes
print(shapes.circle_area(5))
print(shapes.square_perimeter(5)
OUTPUT:
78.53981633974483
20
42
17.
Aim: Use the structure of exception handling all general purpose exceptions.
Program:
a = [1, 2, 3]
try:
print ("Second element = %d" %(a[1]))
except:
print ("An error occurred")
OUTPUT:
Second element = 2
An error occurred
43
18.
Aim: a. Write a function called draw_rectangle that takes a Canvas and a
Rectangle as arguments and draws a representation of the Rectangle on the
Canvas.
Program:
1 import tkinter as tk
2
3 master = [Link]()
4
5
6 def rectangle(event):
7 w.create_rectangle(event.x, event.y, event.x + 10, event.y + 10, fill="blue")
8
9
10 w = [Link](master, width=200, height=200)
11 [Link]()
12
13 [Link]("<Button-1>", rectangle)
14
15 [Link]()
OUTPUT
44
19 .
Aim: Write a Python program to demonstrate the usage of Method Resolution
Order (MRO) in multiple levels of Inheritances.
Program:
class A:
def rk(self):
print(" In class A")
class B(A):
def rk(self):
print(" In class B")
r = B()
[Link]()
Output:
In class B
45
20.
Aim: Write a Python code to merge two given file contents into a third
file.
Program:
data = data2 = ""
# Merging 2 files
# To add the data of file2
# from next line
data += "\n"
data += data2
OUTPUT:
46
21.
Aim: Write a Python code to open a given file and construct a function to check
for given words present in it and display on found.
Program:
OUTPUT:
47
22.
Aim: Write a Python code to Read text from a text file, find the word with most
number of occurrences.
Program:
word = "apple"
count = 0
with open("[Link]", 'r') as f:
for line in f:
words = [Link]()
for i in words:
if(i==word):
count=count+1
print("Occurrences of the word", word, ":", count)
Output:
48
23.
Aim: Write a function that reads a file file1 and displays the number of words,
number of vowels, blank spaces, lower case letters and uppercase letters.
Program:
def counting(filename):
vowel = 0
line = 0
character = 0
49
# Checking if the current character is vowel or not
if alpha in vowels_list:
vowel += 1
character += 1
line += 1
counting('[Link]')
Output:
50
New Lines in [Link] = 2
Number of characters in [Link] = 54
51
24.
Aim: Import numpy, Plotpy and Scipy and explore their functionalities.
Program:
import numpy as np
import [Link] as plt
import scipy as sp
# Reshape an array
g = [Link](b, (3, 2))
# Transpose an array
h = [Link](b)
# matplot
# Create a simple line plot
x = [Link](0, 10, 100)
y = [Link](x)
[Link](x, y)
[Link]()
# Create a histogram
data = [Link](1000)
[Link](data, bins=30)
52
[Link]()
# Scipy
53
25.
Aim: Write a program to implement Digital Logic Gates – AND, OR, NOT, EX-
OR
Program:
# OR gate implementation
def OR_gate(a, b):
if a == 1 or b == 1:
return 1
else:
return 0
54
26.
Aim: Write a program to implement Half Adder, Full Adder, and Parallel Adder
Program:
print(half_adder(9,10))
print(full_adder(10,5,14))
# Parallel Adder
# calling function
a = "1010"
55
b = "1101"
OUTPUT:
(3, 8)
(1, 14)
10111
56