Diploma Engineering
Laboratory Manual
Python Programming
( )
[IT / 1st SEM]
Enrolment No
Name
Branch
Academic Term
Institute
Directorate Of Technical Education
Gandhinagar - Gujarat
Python Programming ( )
DTE’s Vision:
●To provide globally competitive technical education;
●Remove geographical imbalances and inconsistencies;
●Develop student friendly resources with a special focus on girls’ education
and support to weaker sections;
●Develop programs relevant to industry and create a vibrant pool of technical
professionals.
DTE’s Mission:
Institute’s Vision:
Student should write
Institute’s Mission:
Student should write
Department’s Vision:
Student should write
Department’s Mission:
Student should write
Python Programming ( )
Certificate
This is to certify that Mr./Ms ………………………………………………………………….
Enrollment No. ………….……………. of …….………. Semester of Diploma
in……………………………………………………………………………………………………….……..of
………………………………………………………………………. (GTU Code) has satisfactorily completed the
term work in course ………………………………………………………………………………for the academic
year: …………………… Term: Odd/Even prescribed in the GTU curriculum.
Place:…………………..
Date: …………………..
Signature of Course Faculty Head of the Department
Python Programming ( )
Preface
The primary aim of any laboratory/Practical/field work is enhancement of required skills as well as
creative ability amongst students to solve real time problems by developing relevant
competencies in psychomotor domain. Keeping in view, GTU has designed competency focused
outcome-based curriculum -2021 (COGC-2021) for Diploma engineering programmes. In this more
time is allotted to practical work than theory. It shows importance of enhancement of skills
amongst students and it pays attention to utilize every second of time allotted for practical
amongst Students, Instructors and Lecturers to achieve relevant outcomes by performing rather
than writing practice in study type. It is essential for effective implementation of competency
focused outcome- based Green curriculum-2021. Every practical has been keenly designed to
serve as a tool to develop & enhance relevant industry needed competency in each and every
student. These psychomotor skills are very difficult to develop through traditional chalk and board
content delivery method in the classroom. Accordingly, this lab manual has been designed to
focus on the industry defined relevant outcomes, rather than old practice of conducting practical
to prove concept and theory.
By using this lab manual, students can read procedure one day in advance to actual performance
day of practical experiment which generates interest and also, they can have idea of judgement of
magnitude prior to performance. This in turn enhances predetermined outcomes amongst
students. Each and every Experiment /Practical in this manual begins by competency, industry
relevant skills, course outcomes as well as practical outcomes which serve as a key role for doing
the practical. The students will also have a clear idea of safety and necessary precautions to be
taken while performing experiment.
This manual also provides guidelines to lecturers to facilitate student-centered lab activities for
each practical/experiment by arranging and managing necessary resources in order that the
students follow the procedures with required safety and necessary precautions to achieve
outcomes. It also gives an idea that how students will be assessed by providing Rubrics.
Although we try our level best to design this lab manual, but always there are chances of
improvement. We welcome any suggestions for improvement.
Python Programming ( )
Programme Outcomes (POs) :
1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics, science and
engineering fundamentals and engineering specialization to solve the engineering problems.
2. Problem analysis: Identify and analyse well-defined engineering problems using codified
standard methods.
3. Design/ development of solutions: Design solutions for engineering well-defined technical
problems and assist with the design of systems components or processes to meet specified
needs.
4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools and
appropriate technique to conduct standard tests and measurements.
5. Engineering practices for society, sustainability, and environment: Apply appropriate
technology in context of society, sustainability, environment and ethical practices.
6. Project Management: Use engineering management principles individually, as a team
member or a leader to manage projects and effectively communicate about well-defined
engineering activities.
7. Life-long learning: Ability to analyze individual needs and engage in updating in the context of
technological changes in field of engineering.
Python Programming ( )
Practical Outcome - Course Outcome matrix
Course Outcomes (COs):
CO1: Prepare flowchart and algorithm for solving computing problems.
CO2: Develop python programs to solve simple problems.
CO3: Apply control structure feature of python for developing programs.
CO4: Develop Python Programs using built-in functions, modules, and libraries.
CO5: Develop python programs using dictionary, list, string, set and tuple manipulation functions.
CO1 CO2 CO3 CO4 CO5
S. Practical Outcome/Title of experiment
No.
1. Prepare flowchart and algorithm for a
given problem .
Find the sum of two given
numbers
Find a maximum out of two given √
numbers
Find whether a given number is
odd or even
Find a maximum out of three
given numbers
2. Write simple Python program to display √
message on screen( display your name ,date
of birth , and mobile number )
3 python. Develop a Program to identify data- √
. types in
4. (1) : Create a Program to read three √
numbers from the user and find the average
of the numbers.
(2) : Write a Program to convert
temperature from Fahrenheit to Celsius
unit using eq: C=(F-32)/1.8
5. (1) : Identify whether the scanned number √
is even or odd and print an appropriate
message.
(2) : Create a Program to find a maximum
Python Programming ( )
number among the given three numbers.
6. Write a Program to show whether the
√
entered number is prime or not.
7. Develop a Program to find odd and even
√
numbers from 1 to N numbers. (Where N is
an integer number)
Develop a User-defined function to find
√
8. the factorial of a given number.
√
9. Create a User-defined function to print
the Fibonacci series of 0 to N numbers.
(Where N is an integer number and
passed as an argument)
Write a Program using the function that
√
10. reverses the entered value.
Write a Program that determines whether
√
11.
a given number is an ‘Armstrong number’
or not using a user-defined function
(1) : Write a Program to reverse words in a
12. √
given sentence.
(2) : Write a Program to check if a
√
substring is present in a given string.
(3) : Write a Program to count and display
the number of vowels , consonants, √
uppercase, lowercase characters in a
string.
1) Create a programme to find √
13.
the sum of all element in a list
Python Programming ( )
using a loop
2) To find the smallest and largest element
in a given list.
Given a List saved in variable: a = [1, 8, 7, √
15, 25, 36, 48, 64, 81, 95]. Write one line
14. of Python that takes this list and makes a
new list that has only the even elements
of this list in it.
Python Programming ( )
Industry Relevant Skills
The following industry relevant skills are expected to be developed in the students by performance of
experiments of this course.
1. Able to develop any application using python language.
2. Create a professional program using python.
Guidelines to Course Faculty
1. Couse faculty should demonstrate experiment with all necessary implementation strategies
described in curriculum.
2. Couse faculty should explain industrial relevance before starting of each experiment.
3. Course faculty should Involve & give opportunity to all students for hands on experience.
4. Course faculty should ensure mentioned skills are developed in the students by asking.
5. Utilise 2 hrs of lab hours effectively and ensure completion of write up with quiz also.
6. Encourage peer to peer learning by doing same experiment through fast learners.
Instructions for Students
1. Organize the work in the group and make record of all observations.
2. Students shall develop maintenance skill as expected by industries.
3. Student shall attempt to develop related hand-on skills and build confidence.
4. Student shall develop the habits of evolving more ideas, innovations, skills etc.
5. Student shall refer technical magazines and data books.
6. Student should develop habit to submit the practical on date and time.
7. Student should well prepare while submitting write-up of exercise.
Python Programming ( )
Continuous Assessment Sheet
Students Name: Enrolment No:
Subject Name with code:
Faculty Name:
Sr Practical Outcome/Title of experiment Marks
no Page Sign
Date (25)
1. Prepare flowchart and algorithm for a given
problem .
Find the sum of two given numbers
Find a maximum out of two given
numbers
Find whether a given number is odd or
even
Find a maximum out of three given
numbers
2. Write simple Python program to display
message on screen( display your name ,date of
birth , and mobile number )
3 python. Develop a Program to identify data-types in
.
4. (1) : Create a Program to read three numbers
from the user and find the average of the
numbers.
(2) : Write a Program to convert temperature
from Fahrenheit to Celsius unit using eq: C=(F-
32)/1.8
5. (1) : Identify whether the scanned number is
even or odd and print an appropriate message.
(2) : Create a Program to find a maximum
number among the given three numbers.
6. Write a Program to show whether the entered
number is prime or not.
Python Programming ( )
7. Develop a Program to find odd and even
numbers from 1 to N numbers. (Where N is an
integer number)
8. Develop a User-defined function to find the
factorial of a given number.
9.
Create a User-defined function to print the
Fibonacci series of 0 to N numbers. (Where N is
an integer number and passed as an argument)
Write a Program using the function that reverses
10. the entered value.
Write a Program that determines whether a given
11. number is an ‘Armstrong number’ or not using a
user-defined function
(1) : Write a Program to reverse words in a
12. given sentence.
(2) : Write a Program to check if a substring is
present in a given string.
(3) : Write a Program to count and display the
number of vowels , consonants, uppercase,
lowercase characters in a string.
1)Create a programme to find the sum
13. of all element in a list using a loop
2) To find the smallest and largest element in a
given list.
G Given a List saved in variable: a = [1, 8, 7,
14. 15, 25, 36, 48, 64, 81, 95]. Write one line of
Python that takes this list and makes a new list
that has only the even elements of this list in
it.
Python Programming ( )
Python Programming ( )
Python Programming ( )
Python Programming ( )
Python Programming ( )
practical 3 :Develop a Program to identify data-types in python.
A. Objective: Develop a Program to identify data-types in python.
B. Expected Program Outcomes (POs):
1. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
2. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
3. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
4. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
5. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied
industry.
C. Expected Skills to be developed based on competency:
Student will able to understand about various data types and variables in python.
D. Expected Course Outcomes (Cos)
CO1: Develop python programs to solve simple problems.
E. Practical Outcome (PRo) :
Student will able to understand the data and variable structure of python.
F. Prerequisite Theory:
Every value in Python has a data type. Since everything is an object in Python
programming, data types are classes, and variables are instance (object) of these
classes.
There are various data types in Python. Some of the important types are listed below
DATA TYPES IN PYTHON
Python Numbers
Python List
Python Tuple
Python Strings
Python Set
Python Dictionary
Python Programming ( )
Chart : Python Data Types
1. Python Data Type – Numeric
Python numeric data type is used to hold numeric values like;
Data Type Use
Int holds signed integers of non-limited length.
Long holds long integers(exists in Python 2.x,
Float holds floating precision numbers and it’s
complex holds complex numbers.
2. Python Data Type – String
String is a sequence of characters. Python supports Unicode characters. Generally
strings are represented by either single or double quotes.
>>> s1 = "This is a string"
>>> s2= '''a multiline String'''
Single “Hello world”
Line
Python Programming ( )
String
Multi “”” Gwalior
Line
Madhya Pradesh”””
String
Raw String r"raw \n string" [ Used when we want to have a string that contains backslash
and don’t want it to be treated as an escape character.]
Character "C" [ Single letter]
Unic u"\u0938\u0902\u0917\u0940\u0924\u093E" will print 'सगं
ode ीता'
string
1. Python Data type- List
List is a versatile data type exclusive in Python. In a sense it is same as array
in C/C++. But interesting thing about list in Python is it can simultaneously
hold different type of data.
Formally list is a ordered sequence of some data written using square
brackets ([]) and commas (,)
Python Programming ( )
2. Python Tuple
Tuple is an ordered sequences of items same as list. The only difference is
that tuples are immutable. Tuples once created cannot be modified.
Tuples are used to write-protect data and are usually faster than list as it
cannot change dynamically. It is defined within parentheses () where items
are separated by commas
>>> t = (50,'Learning is fun', 1+3j, 45.67) # Can store mixed data types
Advantages of Tuple over List
Since tuple are immutable, iterating through tuple is faster than with list. So
there is a slight performance boost.
We generally use tuple for heterogeneous (different) datatypes and list for
homogeneous (similar) datatypes.
Tuples that contain immutable elements can be used as key for a dictionary.
With list, this is not possible.
If you have data that doesn't change, implementing it as tuple will
guarantee that it remains write-protected.
3. Python Set
Set is an unordered collection of unique items. Set is defined by
values separated by comma inside braces { }.Items in a set are not
ordered.
a = {5,2,3,1,4}
Python Programming ( )
printing set variable
print("a = ", a)
data type of variable a
print(type(a)) # <class 'set'>
4. Python Dictionary
Dictionary is an unordered collection of key-value pairs.
It is generally used when we have a huge amount of data. Dictionaries are
optimized for retrieving data. We must know the key to retrieve the value.
In Python, dictionaries are defined within Curly braces {} with each item
being a pair in the form key: value.
Key and value can be of any type.
Dictionary Values can be printed using key eg d1[‘Name’ ]
G. Resources/Equipment Required
Python Programming ( )
Sr. Instrument/Equipment
Specification Quantity
No
/Components/Trainer
.
kit
H. Questions for quiz:
1. What is the syntax for assigning a value to a variable in Python?
2. What happens if you try to access a variable that has not been assigned a value?
3. Can you reassign a variable to a different data type in Python?
4. What is the difference between a local and a global variable in Python?
Answer:
Python Programming ( )
I. References:
1. https://www.tutorialspoint.com/python/python_data_types.html
2. https://www.w3schools.com/python/python_datatypes.asp
J. Assessment Scheme
Criteria Assessment scale Obtained points
Technical Skills: 5 point - Demonstrates mastery of technical skills and can
use them to solve complex problems.
4 point - Demonstrates proficiency in technical skills and
can use them to solve simple problems.
3 point - Demonstrates basic competency in technical skills
but struggles with more complex tasks.
2 point - Demonstrates limited competency in technical
skills and requires significant assistance.
1 point- Does not demonstrate competency in technical
skills.
Work Quality: 5 point - Produces work that is of exceptional quality and
meets all requirements.
4 point - Produces work that is of good quality and meets
most requirements.
3 point - Produces work that meets some requirements but
requires revision or improvement.
2 point - Produces work that does not meet most
requirements and requires significant revision or
improvement.
1 point - Does not produce work that meets any
requirements.
Collaboration: 5 point - Works effectively with partners or in a group
setting, communicates well, and contributes equally.
4 point - Works well with partners or in a group setting,
communicates effectively, and contributes fairly.
3 point - Works adequately with partners or in a group
setting, communicates somewhat effectively, and
contributes unequally.
2 point - Struggles to work with partners or in a group
setting, communicates poorly, and does not contribute
equally.
1 point - Does not work well with partners or in a group
setting, communicates poorly, and does not contribute.
Initiative: 5 point - Takes initiative to explore new concepts and
tools, goes beyond requirements, and produces exceptional
Python Programming ( )
work.
4 point - Takes initiative to explore some new concepts
and tools, meets requirements, and produces good work.
3 point - Occasionally takes initiative to explore new
concepts and tools, but requires guidance and produces
work that meets basic requirements.
2 point - Rarely takes initiative to explore new concepts
and tools, requires significant guidance, and produces work
that does not meet most requirements.
1 point - Does not take initiative to explore new concepts
and tools, requires constant guidance, and does not meet
any requirements.
Total : ____ /20
Sign with date: _______
Practical No.4 (1): Create a Program to read three numbers from the user
and find the average of the numbers.
A. Objective: Program to read three numbers from the user and find the average
of the numbers.
B. Expected Program Outcomes (POs):
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
c. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied
industry.
C. Expected Skills to be developed based on competency:
Student will able to write a basic program of python to using mathematical equation.
D. Expected Course Outcomes (Cos)
CO1.: Develop python programs to solve simple problems.
E. Practical Outcome (PRo) :
Student will able to write a basic program of python.
Python Programming ( )
F. Prerequisite Theory:
In Program To find the average of three numbers, you need to add up the three
numbers and then divide the sum by 3. Here's the logic in pseudocode:
1. Take three numbers as input from the user
2. Add the three numbers together
3. Divide the sum by 3 to get the average
4. Print the average
Python Code:
a = int (input (" Please Enter the First Number: "))
b = int (input (" Please Enter the second number: "))
c = int (input (" Please Enter the third number: "))
average=(a+b+c)/3
print ("The average of three numbers is ", average)
Output:
Please Enter the First Number: 3
Please Enter the second number: 5
Please Enter the third number: 1
The average of three numbers is 3
G. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Quantity
No
/Components/Trainer
.
kit
Python Programming ( )
H. Questions for quiz:
1. Write a Python program that calculates the moving average of a list of numbers given a window
size.
2. Write a Python program that calculates the weighted average of a list of numbers, given
corresponding weights for each number.
3. Write a Python program that calculates the median of a list of numbers, given an odd number of
elements.
Answer:
I. References:
1. https://pynative.com/
2. https://www.w3schools.com/python/
Python Programming ( )
J. Assessment Scheme
Criteria Assessment scale Obtained points
Technical Skills: 5 point - Demonstrates mastery of technical skills and can
use them to solve complex problems.
4 point - Demonstrates proficiency in technical skills and
can use them to solve simple problems.
3 point - Demonstrates basic competency in technical skills
but struggles with more complex tasks.
2 point - Demonstrates limited competency in technical
skills and requires significant assistance.
1 point- Does not demonstrate competency in technical
skills.
Work Quality: 5 point - Produces work that is of exceptional quality and
meets all requirements.
4 point - Produces work that is of good quality and meets
most requirements.
3 point - Produces work that meets some requirements but
requires revision or improvement.
2 point - Produces work that does not meet most
requirements and requires significant revision or
improvement.
1 point - Does not produce work that meets any
requirements.
Collaboration: 5 point - Works effectively with partners or in a group
setting, communicates well, and contributes equally.
4 point - Works well with partners or in a group setting,
communicates effectively, and contributes fairly.
3 point - Works adequately with partners or in a group
setting, communicates somewhat effectively, and
contributes unequally.
2 point - Struggles to work with partners or in a group
setting, communicates poorly, and does not contribute
equally.
1 point - Does not work well with partners or in a group
setting, communicates poorly, and does not contribute.
Initiative: 5 point - Takes initiative to explore new concepts and
tools, goes beyond requirements, and produces exceptional
work.
4 point - Takes initiative to explore some new concepts
and tools, meets requirements, and produces good work.
3 point - Occasionally takes initiative to explore new
concepts and tools, but requires guidance and produces
work that meets basic requirements.
2 point - Rarely takes initiative to explore new concepts
and tools, requires significant guidance, and produces work
that does not meet most requirements.
1 point - Does not take initiative to explore new concepts
and tools, requires constant guidance, and does not meet
any requirements.
Practical No.4 (2): Write a Program to convert temperature from
Fahrenheit to Celsius unit using eq: C=(F-32)/1.8
A. Objective: Program to convert temperature from Fahrenheit to Celsius. .
Python Programming ( )
B. Expected Program Outcomes (POs):
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
c. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied
industry.
C. Expected Skills to be developed based on competency:
Student will able to write a basic program of python.
D. Expected Course Outcomes(Cos)
CO2: Develop python programs to solve simple problems.
E. Practical Outcome(PRo) :
Student will able to write a basic program of python.
F. Prerequisite Theory:
To convert a temperature from Celsius to Fahrenheit, you can use the formula:
F = (C * 9/5) + 32
where F is the temperature in Fahrenheit, and C is the temperature in Celsius.
Here's the logic in pseudocode to convert Celsius to Fahrenheit:
1. Take the temperature in Celsius as input from the user
2. Convert the temperature from Celsius to Fahrenheit using the formula: F = (C * 9/5) + 32
3. Print the temperature in Fahrenheit
Program:
temperature = float(input("Please enter temperature in fahrenheit:"))
celsius = (temperature - 32) * 5 / 9
print("Temperature in celsius: " , celsius)
Output:
Python Programming ( )
Please enter temperature in fahrenheit: 44
Temperature in celsius: 6.666666666666667
G. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Qu
No
/Components/Trainer anti
.
kit ty
H. References:
1. https://www.python.org/
2. https://www.w3schools.com/python/
I. Quiz Questions:
1. What are the two most common temperature scales used in the world?
2. What are some real-world applications of temperature conversion in
industries such as meteorology, chemistry, and manufacturing?
Answers:
Python Programming ( )
J. Assessment Scheme
Criteria Assessment scale Obtained points
Technical Skills: 5 point - Demonstrates mastery of technical skills and can
use them to solve complex problems.
4 point - Demonstrates proficiency in technical skills and
can use them to solve simple problems.
3 point - Demonstrates basic competency in technical skills
but struggles with more complex tasks.
2 point - Demonstrates limited competency in technical
skills and requires significant assistance.
1 point- Does not demonstrate competency in technical
skills.
Work Quality: 5 point - Produces work that is of exceptional quality and
meets all requirements.
4 point - Produces work that is of good quality and meets
most requirements.
3 point - Produces work that meets some requirements but
requires revision or improvement.
2 point - Produces work that does not meet most
requirements and requires significant revision or
improvement.
1 point - Does not produce work that meets any
requirements.
Collaboration: 5 point - Works effectively with partners or in a group
setting, communicates well, and contributes equally.
4 point - Works well with partners or in a group setting,
Python Programming ( )
communicates effectively, and contributes fairly.
3 point - Works adequately with partners or in a group
setting, communicates somewhat effectively, and
contributes unequally.
2 point - Struggles to work with partners or in a group
setting, communicates poorly, and does not contribute
equally.
1 point - Does not work well with partners or in a group
setting, communicates poorly, and does not contribute.
Initiative: 5 point - Takes initiative to explore new concepts and
tools, goes beyond requirements, and produces exceptional
work.
4 point - Takes initiative to explore some new concepts
and tools, meets requirements, and produces good work.
3 point - Occasionally takes initiative to explore new
concepts and tools, but requires guidance and produces
work that meets basic requirements.
2 point - Rarely takes initiative to explore new concepts
and tools, requires significant guidance, and produces work
that does not meet most requirements.
1 point - Does not take initiative to explore new concepts
and tools, requires constant guidance, and does not meet
any requirements.
Total : ____ /20
Sign with date: _______
Practical No.5 (1): Identify whether the scanned number is even or odd
and print an appropriate message.
A. Objective: Program to Identify whether the scanned number is even or odd and
print an appropriate message.
B. Expected Program Outcomes (POs):
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
c. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied
industry.
C. Expected Skills to be developed based on competency:
Student will able to write a program of python using if and else condition.
D. Expected Course Outcomes (Cos)
Python Programming ( )
CO2: Develop python programs to solve simple problems.
E. Practical Outcome (PRo) :
Student will able to write a basic program of python using conditional operations.
F. Prerequisite Theory:
In Python, "if-else" is a conditional statement used to execute a block of code based on a certain
condition.
Here's the syntax:
if condition:
# code to be executed if condition is True
else:
# code to be executed if condition is False
Here, the "condition" is an expression that returns either True or False. If the condition is True,
then the code inside the "if" block will be executed, and if it's False, the code inside the "else"
block will be executed.
Here's an example:
x = 10
if x > 5:
print("x is greater than 5")
else:
print("x is less than or equal to 5")
In this example, the condition is "x > 5". Since the value of "x" is 10, the condition is True, so the
code inside the "if" block will be executed, and the output will be "x is greater than 5".
Python Programming ( )
Program:
num = int (input (“Enter any number to test whether it is odd or even: “)
if (num % 2) == 0:
print (“The number is even”)
else:
print (“The provided number is odd”)
Output:
Enter any number to test whether it is odd or even:
887
887 is odd
G. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Qu
No
/Components/Trainer anti
.
kit ty
Python Programming ( )
H. References:
1. https://www.python.org/
2. https://www.w3schools.com/python/
I. Questions for quiz:
1. Can 0 be considered an even or odd number? Why or why not?
2. What are some real-world applications of even/odd number checks in computer science,
mathematics, and engineering?
Answers:
Python Programming ( )
J. Assessment Scheme
Criteria Assessment scale Obtained points
Technical Skills: 5 point - Demonstrates mastery of technical skills and can
use them to solve complex problems.
4 point - Demonstrates proficiency in technical skills and
can use them to solve simple problems.
3 point - Demonstrates basic competency in technical skills
but struggles with more complex tasks.
2 point - Demonstrates limited competency in technical
skills and requires significant assistance.
1 point- Does not demonstrate competency in technical
skills.
Work Quality: 5 point - Produces work that is of exceptional quality and
meets all requirements.
4 point - Produces work that is of good quality and meets
most requirements.
3 point - Produces work that meets some requirements but
requires revision or improvement.
2 point - Produces work that does not meet most
requirements and requires significant revision or
improvement.
1 point - Does not produce work that meets any
requirements.
Collaboration: 5 point - Works effectively with partners or in a group
setting, communicates well, and contributes equally.
4 point - Works well with partners or in a group setting,
communicates effectively, and contributes fairly.
3 point - Works adequately with partners or in a group
setting, communicates somewhat effectively, and
contributes unequally.
2 point - Struggles to work with partners or in a group
setting, communicates poorly, and does not contribute
equally.
1 point - Does not work well with partners or in a group
setting, communicates poorly, and does not contribute.
Initiative: 5 point - Takes initiative to explore new concepts and
tools, goes beyond requirements, and produces exceptional
work.
4 point - Takes initiative to explore some new concepts
and tools, meets requirements, and produces good work.
3 point - Occasionally takes initiative to explore new
concepts and tools, but requires guidance and produces
work that meets basic requirements.
2 point - Rarely takes initiative to explore new concepts
and tools, requires significant guidance, and produces work
that does not meet most requirements.
1 point - Does not take initiative to explore new concepts
and tools, requires constant guidance, and does not meet
any requirements.
Total : ____ /20
Sign with date: _______
Practical No.5 (2): Create a Program to find a maximum number among
the given three numbers.
Python Programming ( )
A. Objective: Program to Identify maximum number and print an appropriate
message.
B. Expected Program Outcomes (POs):
1. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
2. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
3. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
4. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
5. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied
industry.
C. Expected Skills to be developed based on competency:
Student will able to write a basic program of python using if and else condition.
D. Expected Course Outcomes (Cos)
CO2: Develop python programs to solve simple problems.
E. Practical Outcome (PRo) :
Student will able to write a basic program of python.
F. Prerequisite Theory:
Program:
a = int(input('Enter first number : '))
b = int(input('Enter second number : '))
c = int(input('Enter third number : '))
Python Programming ( )
largest = 0
if a > b and a > c:
largest = a
if b > a and b > c:
largest = b
if c > a and c > b:
largest = c
print(largest, "is the largest of three numbers.")
Output:
Enter any number to test whether it is odd or even:
887
887 is odd.
Enter first number : 7
Enter second number: 9
Enter third number : 10
10 is the largest of three numbers.
G. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Qu
No
/Components/Trainer anti
.
kit ty
Python Programming ( )
H. References:
a. https://www.python.org/
b. https://www.w3schools.com/python/
I. Questions for quiz:
a. Draw flowchart for finding maximum number from given three numbers.
b. Write pseudo steps to find maximum numbers.
Answers:
Python Programming ( )
J. Assessment Scheme
Criteria Assessment scale Obtained points
Technical Skills: 5 point - Demonstrates mastery of technical skills and can
use them to solve complex problems.
4 point - Demonstrates proficiency in technical skills and
can use them to solve simple problems.
3 point - Demonstrates basic competency in technical skills
but struggles with more complex tasks.
2 point - Demonstrates limited competency in technical
skills and requires significant assistance.
1 point- Does not demonstrate competency in technical
skills.
Work Quality: 5 point - Produces work that is of exceptional quality and
meets all requirements.
4 point - Produces work that is of good quality and meets
most requirements.
3 point - Produces work that meets some requirements but
requires revision or improvement.
2 point - Produces work that does not meet most
requirements and requires significant revision or
improvement.
1 point - Does not produce work that meets any
requirements.
Collaboration: 5 point - Works effectively with partners or in a group
setting, communicates well, and contributes equally.
4 point - Works well with partners or in a group setting,
communicates effectively, and contributes fairly.
3 point - Works adequately with partners or in a group
setting, communicates somewhat effectively, and
contributes unequally.
2 point - Struggles to work with partners or in a group
Python Programming ( )
setting, communicates poorly, and does not contribute
equally.
1 point - Does not work well with partners or in a group
setting, communicates poorly, and does not contribute.
Initiative: 5 point - Takes initiative to explore new concepts and
tools, goes beyond requirements, and produces exceptional
work.
4 point - Takes initiative to explore some new concepts
and tools, meets requirements, and produces good work.
3 point - Occasionally takes initiative to explore new
concepts and tools, but requires guidance and produces
work that meets basic requirements.
2 point - Rarely takes initiative to explore new concepts
and tools, requires significant guidance, and produces work
that does not meet most requirements.
1 point - Does not take initiative to explore new concepts
and tools, requires constant guidance, and does not meet
any requirements.
Total : ____ /20
Sign with date: _______
Practical No. 6: Write a Program to show whether the entered number is
prime or not.
A. Objective: Program to Identify whether the scanned number is even or odd and
print an appropriate message.
B. Expected Program Outcomes (POs):
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
c. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied
industry.
C. Expected Skills to be developed based on competency:
Student will able to write a python program using conditional operation.
D. Expected Course Outcomes (Cos)
CO3: Apply control structure feature of python for developing programs.
E. Practical Outcome (PRo) :
Python Programming ( )
Student will able to write a basic program of python using control structure feature of python.
F. Prerequisite Theory:
In Python, you can easily check whether a number is prime or not using a simple algorithm. A
prime number is a number that is only divisible by 1 and itself.
Here's an example code that checks whether a number is prime or not:
Program:
Using While loop:
# Program to check if a number is prime or not
num = 29
# To take input from the user
#num = int(input("Enter a number: "))
# define a flag variable
flag = False
if num == 1:
print(num, "is not a prime number")
elif num > 1:
# check for factors
for i in range(2, num):
if (num % i) == 0:
# if factor is found, set flag to True
flag = True
# break out of loop
break
# check if flag is True
if flag:
print(num, "is not a prime number")
else:
print(num, "is a prime number")
Python Programming ( )
Output:
Please Enter any Number : 10
1
3
5
7
9
This code defines a function called is_prime that takes a number num as input and
returns True if num is prime and False otherwise. The function first checks if num is
less than or equal to 1, in which case it is not a prime number. It then loops through
all the numbers from 2 to num-1 and checks if num is divisible by any of them. If
num is divisible by any number in this range, then it is not a prime number and the
function returns False. Otherwise, the function returns True.
G. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Quantity
No
/Components/Trainer
.
kit
H. References:
1. https://www.python.org/
2. https://www.w3schools.com/python/
I. Questions for Quiz:
1. Why 0 is not prime number?
2. 1 is prime number or not, Explain it with reason.
Python Programming ( )
Answers:
A. Assessment Scheme
Criteria Assessment scale Obtained points
Technical Skills: 5 point - Demonstrates mastery of technical skills and can
use them to solve complex problems.
Python Programming ( )
4 point - Demonstrates proficiency in technical skills and
can use them to solve simple problems.
3 point - Demonstrates basic competency in technical skills
but struggles with more complex tasks.
2 point - Demonstrates limited competency in technical
skills and requires significant assistance.
1 point- Does not demonstrate competency in technical
skills.
Work Quality: 5 point - Produces work that is of exceptional quality and
meets all requirements.
4 point - Produces work that is of good quality and meets
most requirements.
3 point - Produces work that meets some requirements but
requires revision or improvement.
2 point - Produces work that does not meet most
requirements and requires significant revision or
improvement.
1 point - Does not produce work that meets any
requirements.
Collaboration: 5 point - Works effectively with partners or in a group
setting, communicates well, and contributes equally.
4 point - Works well with partners or in a group setting,
communicates effectively, and contributes fairly.
3 point - Works adequately with partners or in a group
setting, communicates somewhat effectively, and
contributes unequally.
2 point - Struggles to work with partners or in a group
setting, communicates poorly, and does not contribute
equally.
1 point - Does not work well with partners or in a group
setting, communicates poorly, and does not contribute.
Initiative: 5 point - Takes initiative to explore new concepts and
tools, goes beyond requirements, and produces exceptional
work.
4 point - Takes initiative to explore some new concepts
and tools, meets requirements, and produces good work.
3 point - Occasionally takes initiative to explore new
concepts and tools, but requires guidance and produces
work that meets basic requirements.
2 point - Rarely takes initiative to explore new concepts
and tools, requires significant guidance, and produces work
that does not meet most requirements.
1 point - Does not take initiative to explore new concepts
and tools, requires constant guidance, and does not meet
any requirements.
Total: ____ /20
Sign with date: _______
Practical No. 7 : Develop a Program to find odd and even numbers from 1
to N.
B. Objective: Program to Identify whether the scanned number is even or odd and
print an appropriate message.
C. Expected Program Outcomes (POs):
Python Programming ( )
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
c. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied
industry.
D. Expected Skills to be developed based on competency:
Student will able to write a program of python using conditional logic to find odd and even
numbers.
E. Expected Course Outcomes (Cos)
CO2: Develop python programs to solve simple problems.
F. Practical Outcome (PrO) :
Student will able to write a basic program of python.
G. Prerequisite Theory:
In Python, you can easily generate a sequence of numbers from 1 to N and classify each number in
the sequence as odd or even.
To generate a sequence of numbers from 1 to N, you can use a for loop with the range function.
The range function takes two arguments - the starting point and the ending point (not inclusive).
For example, range (1, N+1) will generate a sequence of numbers from 1 to N.
Python Programming ( )
To classify each number in the sequence as odd or even, you can use the modulo operator (%). If a
number is even, then it will have a remainder of 0 when divided by 2. If a number is odd, then it
will have a remainder of 1 when divided by 2.
Program:
Using While loop:
# Python Program to Print Odd Numbers from 1 to N
num = int(input(" Please Enter any Number : "))
for number in range(1, num + 1):
if(number % 2 != 0):
print("{0}".format(number))
Output:
Please Enter any Number : 10
1
3
5
7
9
H. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Qu
No
/Components/Trainer anti
.
kit ty
I. References:
Python Programming ( )
1. https://www.python.org/
2. https://www.w3schools.com/python/
J. Questions for quiz:
Which of the following numbers is even?
a) 17
b) 24
c) 33
d) 40
Answer:
Which of the following numbers is odd?
a) 22
b) 29
c) 36
d) 48
Answer:
How many even numbers are there between 1 and 20?
a) 5
b) 10
c) 15
d) 20
Answer:
How many odd numbers are there between 1 and 30?
a) 10
b) 15
c) 20
d) 25
Answer:
What is the sum of all even numbers between 1 and 50?
a) 600
b) 650
c) 700
d) 750
Answer:
Python Programming ( )
K. Assessment Scheme
Criteria Assessment scale Obtained points
Technical Skills: 5 point - Demonstrates mastery of technical skills and can
use them to solve complex problems.
4 point - Demonstrates proficiency in technical skills and
can use them to solve simple problems.
3 point - Demonstrates basic competency in technical skills
but struggles with more complex tasks.
2 point - Demonstrates limited competency in technical
skills and requires significant assistance.
1 point- Does not demonstrate competency in technical
skills.
Work Quality: 5 point - Produces work that is of exceptional quality and
meets all requirements.
4 point - Produces work that is of good quality and meets
most requirements.
3 point - Produces work that meets some requirements but
requires revision or improvement.
2 point - Produces work that does not meet most
requirements and requires significant revision or
improvement.
1 point - Does not produce work that meets any
requirements.
Collaboration: 5 point - Works effectively with partners or in a group
setting, communicates well, and contributes equally.
4 point - Works well with partners or in a group setting,
communicates effectively, and contributes fairly.
3 point - Works adequately with partners or in a group
setting, communicates somewhat effectively, and
contributes unequally.
2 point - Struggles to work with partners or in a group
setting, communicates poorly, and does not contribute
equally.
1 point - Does not work well with partners or in a group
setting, communicates poorly, and does not contribute.
Initiative: 5 point - Takes initiative to explore new concepts and
tools, goes beyond requirements, and produces exceptional
work.
4 point - Takes initiative to explore some new concepts
Python Programming ( )
and tools, meets requirements, and produces good work.
3 point - Occasionally takes initiative to explore new
concepts and tools, but requires guidance and produces
work that meets basic requirements.
2 point - Rarely takes initiative to explore new concepts
and tools, requires significant guidance, and produces work
that does not meet most requirements.
1 point - Does not take initiative to explore new concepts
and tools, requires constant guidance, and does not meet
any requirements.
Practical No. 8 : Develop a User-defined function to find the factorial of a
given number.
A. Objective: Program to Identify whether the scanned number is even or odd and
print an appropriate message.
B. Expected Program Outcomes (POs):
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
c. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied
industry.
C. Expected Skills to be developed based on competency:
Student will able to write a basic program of python using loops and conditional operation.
D. Expected Course Outcomes (Cos)
CO3: Apply control structure feature of python for developing programs.
E. Practical Outcome (PRo) :
Student will able to write a basic program of python using loops and conditional operation.
Python Programming ( )
F. Prerequisite Theory:
In Python, a user-defined function is a block of reusable code that performs a specific task. A user-
defined function can be created using the def keyword, followed by the name of the function and
its parameters enclosed in parentheses. The body of the function is indented below the def
statement.
Here is the general syntax for creating a user-defined function in Python:
def function_name(parameter1, parameter2, ...):
# function body
# statements
return value
The parameter1, parameter2, and so on, are optional parameters that can be passed to the
function. These parameters are used to pass data to the function for processing. The return
statement is optional and is used to return a value from the function.
When a function is called, the arguments passed to the function are assigned to the parameters in
the function definition. The function then executes the statements in its body, and if a return
statement is encountered, the function returns the value specified by the return statement.
Program:
def factorial(num):
if num == 1:
return 1
else:
return num * factorial(num-1)
num = int(input("Enter a number: "))
result = factorial(num)
print("The factorial of", num, "is", result)
Output:
Enter a number: 5
The factorial of 5 is 120
Python Programming ( )
G. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Qu
No
/Components/Trainer anti
kit ty
H. Assessment Scheme
Performance indicators Weightag
e
Process related (35 Marks) 70%
1. Logic Formulation 10%
2. Debugging Ability 20%
3. Follow ethical practices 40%
Product related (15 Marks) 30%
4. Expected output 10%
5. Timely Submission of report 10%
6. Answer to sample questions 10%
Total (50 Marks) 100%
Marks Obtained Dated signature
Python Programming ( )
of Teacher
Process Product Total (50)
Related (35) Related (15)
Total : ____ /20
Sign with date: _______
Practical No. 9 : Create a User-defined function to print the Fibonacci
series of 0 to N numbers. (Where N is an integer number and passed as an
argument).
A. Objective: Program to Identify whether the scanned number is even or odd and
print an appropriate message.
B. Expected Program Outcomes (POs):
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific knowledge to
solve core computer engineering related problems
Python Programming ( )
c. Experiments and practice: Plan to perform experiments and practices to use the results
to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the context
of technological changes in the computer engineering field and allied industry.
C. Expected Skills to be developed based on competency:
Student will able to write a basic program of python.
D. Expected Course Outcomes(Cos)
CO2: Develop python programs to solve simple problems.
E. Practical Outcome(PRo) :
Student will able to write a basic program of python.
F. Prerequisite Theory:
The Fibonacci numbers are the numbers in the following integer sequence.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence
relation
Fn = Fn-1 + Fn-2
with seed values
F0 = 0 and F1 = 1.
Program:
# Program to display the Fibonacci sequence up to n-th term
nterms = int(input("How many terms? "))
# first two terms
n1, n2 = 0, 1
count = 0
# check if the number of terms is valid
if nterms <= 0:
print("Please enter a positive integer")
# if there is only one term, return n1
elif nterms == 1:
print("Fibonacci sequence upto",nterms,":")
Python Programming ( )
print(n1)
# generate fibonacci sequence
else:
print("Fibonacci sequence:")
while count < nterms:
print(n1)
nth = n1 + n2
# update values
n1 = n2
n2 = nth
count += 1
Output:
How many terms? 7
Fibonacci sequence:
0
1
1
2
3
5
8
G. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Qu
No
/Components/Trainer anti
.
kit ty
Python Programming ( )
H. References:
1. https://www.python.org/
2. https://www.w3schools.com/python/
I. Questions for quiz:
1. What is Fibonacci series?
2. Is 0 considered in the Fibonacci series? Give answer with reason.
3. Write a program to print Fibonacci series up to n numbers with inbuilt function of python.
Answers:
Python Programming ( )
J. Assessment Scheme
Criteria Assessment scale Obtained points
Technical Skills: 5 point - Demonstrates mastery of technical skills and can
use them to solve complex problems.
4 point - Demonstrates proficiency in technical skills and
can use them to solve simple problems.
3 point - Demonstrates basic competency in technical skills
but struggles with more complex tasks.
2 point - Demonstrates limited competency in technical
skills and requires significant assistance.
1 point- Does not demonstrate competency in technical
skills.
Work Quality: 5 point - Produces work that is of exceptional quality and
meets all requirements.
4 point - Produces work that is of good quality and meets
most requirements.
3 point - Produces work that meets some requirements but
requires revision or improvement.
2 point - Produces work that does not meet most
requirements and requires significant revision or
improvement.
1 point - Does not produce work that meets any
requirements.
Collaboration: 5 point - Works effectively with partners or in a group
setting, communicates well, and contributes equally.
4 point - Works well with partners or in a group setting,
communicates effectively, and contributes fairly.
3 point - Works adequately with partners or in a group
setting, communicates somewhat effectively, and
contributes unequally.
2 point - Struggles to work with partners or in a group
setting, communicates poorly, and does not contribute
equally.
1 point - Does not work well with partners or in a group
setting, communicates poorly, and does not contribute.
Initiative: 5 point - Takes initiative to explore new concepts and
tools, goes beyond requirements, and produces exceptional
work.
4 point - Takes initiative to explore some new concepts
and tools, meets requirements, and produces good work.
3 point - Occasionally takes initiative to explore new
concepts and tools, but requires guidance and produces
work that meets basic requirements.
2 point - Rarely takes initiative to explore new concepts
and tools, requires significant guidance, and produces work
that does not meet most requirements.
1 point - Does not take initiative to explore new concepts
Python Programming ( )
and tools, requires constant guidance, and does not meet
any requirements.
Total: ____ /20
Sign with date: _______
Practical No. 10 : Write a Program using the function that reverses the
entered value.
Objective: Program to Identify whether the scanned number is even or odd and
print an appropriate message.
I. Expected Program Outcomes (POs):
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
c. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied industry.
J. Expected Skills to be developed based on competency:
Student will able to write a basic program of python.
K. Expected Course Outcomes(Cos)
CO2: Develop python programs to solve simple problems.
L. Practical Outcome(PRo) :
Student will able to write a basic program of python.
Python Programming ( )
M. Prerequisite Theory:
Program:
Program
# Ask for enter the number from the use
number = int(input("Enter the integer number: "))
# Initiate value to null
revs_number = 0
# reverse the integer number using the while loop
while (number > 0):
# Logic
remainder = number % 10
revs_number = (revs_number * 10) + remainder
number = number // 10
# Display the result
print("The reverse number is : {}".format(revs_number))
Output:
Enter the integer number: 12345
The reverse number is: 54321
N. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Qu
No
/Components/Trainer anti
.
kit ty
Python Programming ( )
O. Assessment Scheme
Performance indicators Weightag
e
Process related (35 Marks) 70%
1. Logic Formulation 10%
2. Debugging Ability 20%
3. Follow ethical practices 40%
Product related (15 Marks) 30%
4. Expected output 10%
5. Timely Submission of report 10%
6. Answer to sample questions 10%
Total (50 Marks) 100%
Marks Obtained Dated signature
of Teacher
Process Product Total (50)
Related (35) Related (15)
Python Programming ( )
Practicle : 11
Python Programming ( )
Python Programming ( )
Python Programming ( )
Python Programming ( )
Practical No. 12 (1) : Write a Program to reverse words in a given
sentence.
Python Programming ( )
Objective: Program to Identify whether the scanned number is even or odd and
print an appropriate message.
P. Expected Program Outcomes (POs):
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
c. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied industry.
Q. Expected Skills to be developed based on competency:
Student will able to write a basic program of python.
R. Expected Course Outcomes(Cos)
CO2: Develop python programs to solve simple problems.
S. Practical Outcome(PRo) :
Student will able to write a basic program of python.
T. Prerequisite Theory:
Program:
# Python code
# To reverse words in a given string
Python Programming ( )
# input string
string = "Python is best programming language"
# reversing words in a given string
s = string.split()[::-1]
l = []
for i in s:
# apending reversed words to l
l.append(i)
# printing reverse words
print(" ".join(l))
Output:
Language programming best is Python
U. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Qu
No
/Components/Trainer anti
.
kit ty
Python Programming ( )
V. Assessment Scheme
Performance indicators Weightag
e
Process related (35 Marks) 70%
1. Logic Formulation 10%
2. Debugging Ability 20%
3. Follow ethical practices 40%
Product related (15 Marks) 30%
4. Expected output 10%
5. Timely Submission of report 10%
6. Answer to sample questions 10%
Total (50 Marks) 100%
Marks Obtained Dated signature
of Teacher
Process Product Total (50)
Related (35) Related (15)
Practical No. 12 (2) : Write a Program to check if a substring is present in
a given string.
Objective: Program to Identify whether the scanned number is even or odd and
print an appropriate message.
W. Expected Program Outcomes (POs):
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
c. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied industry.
X. Expected Skills to be developed based on competency:
Student will able to write a basic program of python.
Python Programming ( )
Y. Expected Course Outcomes(Cos)
CO2: Develop python programs to solve simple problems.
Z. Practical Outcome(PRo) :
Student will able to write a basic program of python.
AA. Prerequisite Theory:
Program:
# Take input from users
MyString1 = " Python is best programming language "
if "best" in MyString1:
print("Yes! it is present in the string")
else:
print("No! it is not present")
Output:
Yes! it is present in the string
BB. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Qu
No
/Components/Trainer anti
.
kit ty
Python Programming ( )
CC. Assessment Scheme
Performance indicators Weightag
e
Process related (35 Marks) 70%
1. Logic Formulation 10%
2. Debugging Ability 20%
3. Follow ethical practices 40%
Product related (15 Marks) 30%
4. Expected output 10%
5. Timely Submission of report 10%
6. Answer to sample questions 10%
Total (50 Marks) 100%
Marks Obtained Dated signature
of Teacher
Process Product Total (50)
Related (35) Related (15)
Python Programming ( )
Practical No. 12 (3) : Write a Program to count and display the number of
vowels, consonants, uppercase, lowercase characters in a string.
Objective: Program to Identify whether the scanned number is even or odd and
print an appropriate message.
DD. Expected Program Outcomes (POs):
a. Basic knowledge: Apply knowledge of basic mathematics, sciences, and basic
engineering to solve the broad-based Computer engineering problem.
b. Discipline knowledge: Apply Computer engineering discipline - specific
knowledge to solve core computer engineering related problems
c. Experiments and practice: Plan to perform experiments and practices to use the
results to solve broad-based Computer engineering problems.
d. Individual and team work: Function effectively as a leader and team member in
diverse/ multidisciplinary teams.
e. Life-long learning: Engage in independent and life-long learning activities in the
context of technological changes in the computer engineering field and allied industry.
EE. Expected Skills to be developed based on competency:
Student will able to write a basic program of python.
FF. Expected Course Outcomes(Cos)
CO2: Develop python programs to solve simple problems.
GG. Practical Outcome(PRo) :
Student will able to write a basic program of python.
Python Programming ( )
HH. Prerequisite Theory:
Program:
string = input("Enter a string: ")
vowels = 0
consonants = 0
uppercase = 0
lowercase = 0
for char in string:
if char in "aeiouAEIOU":
vowels += 1
elif char.isalpha():
consonants += 1
if char.isupper():
uppercase += 1
else:
lowercase += 1
print("Number of vowels:", vowels)
print("Number of consonants:", consonants)
print("Number of uppercase characters:", uppercase)
print("Number of lowercase characters:", lowercase)
Output:
Enter a string: Hello, World!
Number of vowels: 3
Number of consonants: 8
Number of uppercase characters: 2
Number of lowercase characters: 8
II. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Qu
No
/Components/Trainer anti
.
kit ty
Python Programming ( )
JJ. Assessment Scheme
Performance indicators Weightag
e
Process related (35 Marks) 70%
1. Logic Formulation 10%
2. Debugging Ability 20%
3. Follow ethical practices 40%
Product related (15 Marks) 30%
4. Expected output 10%
5. Timely Submission of report 10%
6. Answer to sample questions 10%
Total (50 Marks) 100%
Marks Obtained Dated signature
of Teacher
Process Product Total (50)
Related (35) Related (15)
Date:...........
Practical No.13 (1): Develop programs to perform the following list operations.
a) To find the sum of elements in a list.
A. Objective:
Python Programming ( )
To modify the original list by swapping the elements, and to calculate the total value of all the
elements in the list.
B. Expected Program Outcomes (POs)
PO2, РО3, РО4, РО6, РО7
C. Expected Skills to be developed based on competency:
◦ Ability to iterate over all elements in a list and sum them up.Expected Course Outcome(Cos)
D. Expected code outcome
◦ C05
E. Practical Outcome PRo
Swapping elements in a list allows for the manipulation and reordering of data within the list,
while finding the sum of elements in a list allows for analysis of the data within the list.
F. Expected Affective domain Outcome(ADos)
Improve ability to create reliable, and useful python code.
Ensure adequate testing, debugging and review of code.
1 Follow safety practices.
2 Demonstrate error free code.
Follow ethical practices.
G. Prerequisite Theory:
sum()
Python provides an inbuilt function sum) which sums up the numbers in the list.
Syntax:
sumiterable, start)
iterable: iterable can be anything list, tuples or dictionaries ,but most importantly it should be
numbers.
start : this start is added to the sum of numbers in the iterable.
If start is not given in the syntax, it is assumed to be O.
Possible two syntaxes:
Python Programming ( )
sum(a)
a is the list, it adds up all the numbers in the list a and takes start to be 0, so returning only the
sum of the numbers in the list. suma, start)
Python Programming ( )
Python Programming ( )
Python Programming ( )
Practical : 13 (2)
Python Programming ( )
Python Programming ( )
Python Programming ( )
SPractical: 14
Python Programming ( )
Python Programming ( )
Python Programming ( )
Python Programming ( )
Python Programming ( )
Python Programming ( )
Python Programming ( )
Python Programming ( )
Python Programming ( )