Python Solution
Python Solution
Engineering
Laboratory Manual
Python Programming
(4311601)
Name
Branch
Academic Term
Institute
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:
Institute’s Mission:
Department’s Vision:
Department’s Mission:
PythonProgramming(4311601)
Certificate
Place:…………………..
Date: …………………..
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.
Python is a popular language for solving a wide range of problems, and experimenting with
Python programming can help students develop problem-solving skills that are valuable in many
industries. By working on coding challenges and projects, students can learn how to break down complex
problems into smaller, more manageable pieces, and develop logical, efficient solutions using Python
code.By experimenting with Python programming, students can develop a strong foundation in these
concepts, which can be applied to other programming languages and tools.
Although we try our level best to design this lab manual, but always there are chances of
improvement. We welcome any suggestions for improvement.
3 | Page
PythonProgramming(4311601)
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.
4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools and
appropriate technique to conduct standard tests and measurements.
7. Life-long learning: Ability to analyze individual needs and engage in updating in the context
of technological changes in field of engineering.
4 | Page
PythonProgramming(4311601)
5 | Page
PythonProgramming(4311601)
A) B)
1 *****
12 ****
14.
123 ***
1234 **
12345 *
6 | Page
PythonProgramming(4311601)
The following industry relevant skills are expected to be developed in the students by
performance of experiments of this course.
● Problem-solving skills
● Programming fundamentals
● Collaboration skills
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.
7 | Page
PythonProgramming(4311601)
9
Create a program to find a maximum number among
the given three numbers.
10 Develop a program to demonstrate the basic
functionalities of a standard calculator.
11 Write a python program to print 1 to 10 numbers using
loops.
12 Develop a program to find odd and even numbers from
1 to N numbers. (Where N is an integer number)
13 Write a program to show whether the entered number
is prime or not.
PythonProgramming(4311601)
14
Create a program to display the following patterns.
A) B)
1 *****
12 ****
123 ***
1234 **
12345 *
15
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)
16
Develop a user-defined function to find the factorial of
a given number.
17
Write a program using the function that reverses the
entered value.
18
Write a program that determines whether a given
number is an armstrong number or a palindrome using
a user-defined function.
19 Write a program to find the length of a string.
20 Write a program to reverse words in a given sentence.
21
Write a program to check if a substring is present in a
given string
22
Write a program to count and display the number of
vowels, consonants, uppercase, lowercase characters
in a string.
23
Develop programs to perform the following list
operations.
a) To swap given two elements in a list.
b) To find the sum of elements in a list.
24
Develop programs to perform the following list
operations.
a) To check if an element exists in a given list.
b) To find the smallest and largest element in a given
list.
25
a) Given a list saved in variable: a = [1, 4, 9, 16, 25, 36,
49, 64, 81, 100]. 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.
b) Create a list containing the square of all odd
numbers from range 1 to 10.
c) Create a list of prime and non-prime numbers in
range 1 to 50.
PythonProgramming(4311601)
Date: ……………
Practical No.1:Prepare flowchart and algorithm for a given problem.(Following are the sample
programs. Faculty can select any other similar programs for the practice of the students.)
i. Find the sum of two given numbers.
ii. Find a maximum out of two given numbers.
iii. Find whether a given number is odd or even.
iv. Find a maximum out of three given numbers.
A. Objective:
Able to use symbols for a flowchart and prepare an algorithm for a given problem.
Q.1Prepareflowchartandalgorithmtofindthesumoftwogiven numbers.Flowchart:
Algorithm:
Step1:Start
Step 2: Declare variables num1, num2 and
sum.Step3:Readvaluesfornum1,num2.
Step 4: Add num1 and num2 and assign the result to
avariablesum.
Step 5: Display
sumStep6:Stop
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
PythonProgramming(4311601)
Flowchart:
Algorithm:
PythonProgramming(4311601)
Q.3Prepareflowchartandalgorithmtofindagivennumberisoddoreven.Flowchart:
Algorithm:
PythonProgramming(4311601)
Algorithm:
• Prepare flowchart and algorithm to read a number N and print all its divisors.
• Draw a flowchart to find the sum of given N numbers.
M. References / Suggestions
1. https://www.programiz.com/article/flowchart-programming
2. https://infomaxacademy.com/concept-of-python-exchanging-values-of-
two-variables
N. Assessment-Rubrics
Total
ate: ……………
A. Objective:
Step 3: On this page move to Files and click on Windows x86-64 executable installer for
64-bit or Windows x86 executable installer for 32-bit.
● This is Python Interpreter also called Python Shell. I printed Hello geeks, python is
working smoothly.
● The three greater than >>> sign is called Python command prompt, where we write our
program and with a single enter key, it will give result so instantly.
H. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
PythonProgramming(4311601)
K. Assessment-Rubrics
Total
Date: ……………
Practical No.3: Create a program to print your name, mobile number, and date of birth.
A. Objective:
To create a program that prints your name, mobile number, and date of birth as
output.
B. Expected Program Outcomes (POs)
PO1, PO2, PO3, PO4, PO6, PO7
CO2
E. Practical Outcome(PRo)
Step2:DefiningtheProgram Logic
1.Startbydefiningafunctionthatwillhandletheprintingofpersonalinformation.Addthefollo
wing codetoyour‘personal_info.py’file:
defprint_personal_info(name,mobile_number,date_of_birth):
PythonProgramming(4311601)
print("Name:", name)
print("Mobile Number:", mobile_number)
print("Date of Birth:", date_of_birth)
print_personal_info(name,mobile_number,date_of_birth)
2. This code prompts the user to enter their name, mobile number, and date
of birth using the ‘input’ function. The entered values are stored in the
respective variables (‘name’, ‘mobile_number’, ‘date_of_birth’).
3. Finally, the ‘print_personal_info’ function is called with the gathered input
to display the information.
pythonpersonal_info.py
4. The program will prompt you to enter your name, mobile number, and date
of birth. After providing the input, it will print the information on the
console.
PythonProgramming(4311601)
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
def greet_morning():
greet_morning()
PythonProgramming(4311601)
Output:
L. References / Suggestions
https://docs.python.org/3/tutorial/
M. Assessment-Rubrics
Total
ate: ……………
Practical No.04: Develop a program to identify data-types in python.
A. Objective:
Use of data-types in python programming to build the any program.
• Finally, the program prints the data type of the entered value using an f-
string.
def identify_data_type(value):
if isinstance(value, int):
return "Integer"
elifisinstance(value, float):
return "Float"
elifisinstance(value, str):
return "String"
elifisinstance(value, bool):
return "Boolean"
elifisinstance(value, list):
return "List"
elifisinstance(value, tuple):
return "Tuple"
elifisinstance(value, dict):
return "Dictionary"
elif value is None:
return "None"
else:
return "Unknown"
# User input
user_input = input("Enter a value: ")
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
PythonProgramming(4311601)
Source code:
Output:
PythonProgramming(4311601)
L. References / Suggestions
1. https://www.tutorialspoint.com/python/python_data_types.htm
2. https://www.programiz.com/python-programming
M. Assessment-Rubrics
Total
ate: ……………
Practical No.5: Create a program to read three numbers from the user and find the
average of the numbers.
A. Objective:
Explanation:
PythonProgramming(4311601)
1. The program prompts the user to enter three numbers using the input() function.
We use the float() function to convert the input to a floating-point number,
allowing decimal values.
2. The three numbers are stored in the variables num1, num2, and num3, respectively.
3. To calculate the average, we add the three numbers together and divide the sum by
3. The result is stored in the variable average.
4. Finally, the program prints the calculated average using the print() function. We
concatenate the average value with the string "The average of the three numbers
is:" using a comma (,) to separate them in the print statement.
H. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
Source Code:
Output:
K. References / Suggestions
1. https://www.tutorialspoint.com/python/python_numbers.htm
2. https://www.programiz.com/python-programming
3. https://www.w3schools.com/python/
4. https://www.geeksforgeeks.org/python-programming-language/
L. Assessment-Rubrics
Total
ate: ……………
Practical No.06: Develop a program that can calculate simple interest and compound interest
on given data.
A. Objective:
H. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
Source Code
Output:
K. References / Suggestions
1. https://www.tutorialspoint.com/python/python_numbers.htm
2. https://www.programiz.com/python-programming
3. https://www.w3schools.com/python/
4. https://www.geeksforgeeks.org/python-programming-language/
L. Assessment-Rubrics
Total
ate: ……………
Practical No.07: Write a program to convert temperature from Fahrenheit to Celsius unit using
equation: C=(F-32)/1.8
A. Objective:
Make a use of Arithmetic expressions in python.
B. Expected Program Outcomes (POs)
PO1, PO2, PO3, PO4, PO6, PO7
CO2
E. Practical Outcome(PRo)
Calculate conversion from Fahrenheit to Celsius.
H. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
Output:
K. References / Suggestions
1. https://www.tutorialspoint.com/python/python_numbers.htm
2. https://www.programiz.com/python-programming
3. https://www.w3schools.com/python/
4. https://www.geeksforgeeks.org/python-programming-language/
L. Assessment-Rubrics
Total
ate: ……………
Practical No.8: Identify whether the scanned number is even or odd and print an appropriate
message.
A. Objective:
CO3
E. Practical Outcome(PRo)
Print even or odd numbers.
F. Expected Affective domain Outcome(ADos)
Follow ethical practices
G. Program Code and Theory:
def check_even_odd(number):
if number % 2 == 0:
return "Even"
else:
return "Odd"
Explanation:
1. The program defines a function called check_even_odd that takes a number as an
input parameter.
2. Inside the function, it checks if the number is divisible by 2 using the modulo
operator (%). If the remainder is 0, it means the number is even; otherwise, it is odd.
3. If the number is even, the function returns the string "Even". If the number is odd,
it returns the string "Odd".
4. The program prompts the user to enter a number.
5. The input number is stored in the variable number.
6. The program calls the check_even_odd function, passing the number as an
argument, and assigns the returned result to the variable result.
7. Finally, it prints the appropriate message by concatenating the result with the string
"The number is".
H. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
if number > 0:
PythonProgramming(4311601)
Output:
K. References / Suggestions
1. https://www.tutorialspoint.com/python/python_numbers.htm
2. https://www.programiz.com/python-programming
3. https://www.w3schools.com/python/
4. https://www.geeksforgeeks.org/python-programming-language/
L. Assessment-Rubrics
Total
Date: …………
Practical No.9: Create a program to find a maximum number among the given three
numbers.
A. Objective:
if..elif..else statement
:Syntax:
if
(expression1):s
tatement(s)
elif
(expression2):sta
tement(s)
elif
(expression3):sta
tement(s)
else:
PythonProgramming(4311601)
statement(s)
Example:
runs=100
if (runs==200):
print("Goodbye!")
L. Input-Output:
Input:
PythonProgramming(4311601)
Output:
numbers = [12, 45, 8, 32, 19, 67, 23, 56, 15, 72]
numbers.sort(reverse=True)
second_largest = numbers[1]
print("The second largest element is:", second_largest)
N. References / Suggestions
https://docs.python.org/3/tutorial/controlflow.html
O. Assessment-Rubrics
PythonProgramming(4311601)
Total
Date: ……………
Practical No.10: Develop a program to demonstrate the basic functionalities of a
standard calculator.
A. Objective:
● Able to apply arithmetic operators and conditional statements to solve real world
problems
+ Addition a+b
- Subtraction a–b
* Multiplication a*b
/ Division a/b
% Modulus a%b
** Exponential a ** b
// Floor Division a // b
PythonProgramming(4311601)
Ensure that all the necessary equipment and software are in good working
condition.
K. Source code :
L. Input-Output:
Input:
Enter first number: 5
Enter Operator (+,-,*,/,%): *
Enter second number: 4
Output: 20.0
if number % 2 == 0:
print(f"{number} is even.")
else:
print(f"{number} is odd."
PythonProgramming(4311601)
N. References / Suggestions
Total
Date: …………
Practical No.11: Write a python program to print 1 to 10 numbers using loops.
A. Objective:
Use of various loops using python
Syntax: Example:
while expression: count = 0
statement(s) while(count < 3):
print("Hello World")
count = count + 1
2. for loop
Syntax: Example:
PythonProgramming(4311601)
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
L. Input-Output:
Input:
Output:
N. References / Suggestions
https://wiki.python.org/moin/ForLoop
O. Assessment-Rubrics
Total
Date: …………
Practical No.12: Develop a program to find odd and even numbers from 1 to N numbers.
(Where N is an integer number)
A. Objective:
● Able to apply various looping constructs with conditional statements to solve real
world problems
if condition:
# Code to execute if the condition is True
else:
# Code to execute if the condition is False
H. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
odd_numbers = []
even_numbers = []
K. Input-Output:
M. References / Suggestions
https://wiki.python.org/moin/ForLoop
N. Assessment-Rubrics
Total
Date: …………
Practical No.13: Write a program to show whether the entered number is prime or not
A. Objective:
Use of various loops, arithmetic operators and conditional statements using
python
H. Resources/Equipment Required
i=5
PythonProgramming(4311601)
try:
num = int(input("Enter a number: "))
if is_prime(num):
print(num, "is a prime number.")
else:
print(num, "is not a prime number.")
except ValueError:
print("Invalid input. Please enter a valid number."
PythonProgramming(4311601)
sum_of_primes = 0
for i in range(2, 41):
if is_prime(i):
sum_of_primes += i
L. References / Suggestions
https://wiki.python.org/moin/ForLoop
M. Assessment-Rubrics
Total
Date………….
A) B)
1 *****
12 ****
123 ***
1234 **
12345 *
A. Objective:
Keep the workspace clean and organized, free from clutter and unnecessary
materials.
Use the software according to its intended purpose and instructions.
Ensure that all the necessary equipment and software are in good working
condition.
J. Source code :
A)
for i in range(1, n + 1):
for j in range(1, i + 1):
print(j, end=' ')
print()
B)
for i in range(n, 0, -1):
for j in range(i):
print("*", end=" ")
print()
K. Input-Output:
Input:
Output:
n=5
for i in range(n, 0, -1):
print('A' * i)
PythonProgramming(4311601)
M. References / Suggestions
https://wiki.python.org/moin/ForLoop
N. Assessment-Rubrics
Total
Date: …………
Practical No.15: 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:
● Able to apply various looping constructs and creating user defined functions to
solve real world problems
# Calling
functionmyFun()
H. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
def fibonacci_series(n):
a, b = 0, 1
for _ in range(n):
print(a, end=' ')
a, b = b, a + b
K. Input-Output:
Output: 0 1 1 2 3 5 8 13 21 34
M. References / Suggestions
https://docs.python.org/3/tutorial/controlflow.html#defining-functions
N. Assessment-Rubrics
Total
Date: …………
Practical No.16: Develop a user-defined function to find the factorial of a given
number.
A. Objective:
def calculate_factorial(n):
if n < 0:
return "Factorial is not defined for negative numbers"
elif n == 0:
return 1
else:
factorial = 1
for i in range(1, n + 1):
factorial *= i
return factorial
result = calculate_factorial(num)
print(f"The factorial of {num} is {result}"
PythonProgramming(4311601)
K. Input-Output:
def is_palindrome(number):
number_str = str(number)
reversed_str = number_str[::-1]
return number_str == reversed_str
number = 121
result = is_palindrome(number)
if result:
print(f"{number} is a palindrome")
else:
print(f"{number} is not a palindrome")
M. References / Suggestions
https://docs.python.org/3/tutorial/controlflow.html#defining-functions
N. Assessment-Rubrics
Total
PythonProgramming(4311601)
Date: …………
Practical No.17: Write a program using the function that reverses the entered value.
A. Objective:
Use of various loops and user defined functions using python
● Able to apply various looping constructs and creating user defined functions to
solve real world problems
H. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
K. Input-Output:
# Example usage:
number = 5
result = is_odd_or_even(number)
print(f"{number} is {result}")
M. References / Suggestions
https://docs.python.org/3/tutorial/controlflow.html#defining-functions
N. Assessment-Rubrics
Total
Date: …………
Practical No.18: Write a program that determines whether a given number is an
armstrong number or a palindrome using a user-defined function.
A. Objective:
To check whether the given number is equal to the sum of its own digits raised to
the power of the number of digits
To check whether the given number remains the same when its digits are
reversed.
Input :
153Output:Y
es
153 is an Armstrong
number.1*1*1+5*5*5+3*3*3=153
Input :
120Output:
No
120 is not a Armstrong
number.1*1*1+2*2*2+0*0*0=9
Input :
1253Output:
No
1253isnotaArmstrongNumber
1*1*1*1 +2*2*2*2+5*5*5*5+3*3*3*3= 723
Input :
1634Output:
Yes
1*1*1*1 +6*6*6*6+3*3*3*3+4*4*4*4= 1634
Palindrome Number
A palindrome number is a number that remains the same when its digits are
reversed. For example, 121 is a palindrome number because it reads the same from
left to right and right to left. Palindrome numbers are commonly used in
mathematics and computer science, and they have various applications in these
fields.
To determine whether a given number is a palindrome, we can follow these steps:
Example:
Enterthenumber:1234
The reverse number
is:4321Thenumberisnotapalindro
me
PythonProgramming(4311601)
Enterthenumber:23434
The reverse number
is:43432Thenumberisnotapalindro
me
Step 2-Declare and initialize the variable reverse and assign input to a temp
variable tempNum=num
Step 3-Start the while loop until num !=0 becomes false
rem = num % 10
reverse*= 10 + rem
num = num / 10
Step 4- Check if reverse == tempNum
Step 5-If it’s true then the number is a palindrome
Step 6-If not, the number is NOT a palindrome
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
PythonProgramming(4311601)
number = 121
result = is_palindrome(number)
if result:
print(f"{number} is a palindrome")
else:
print(f"{number} is not a palindrome")
L. Input-Output:
Input:The input to the program is the variable number, which is set to the integer
121.
start = 1
end = 200
PythonProgramming(4311601)
N. References / Suggestions
https://www.youtube.com/watch?v=fdxtmMOfdrc
https://youtu.be/uUIucXNMEKc
https://youtu.be/IvblQdIwFQI?list=PLgwJf8NK-2e5pY2eB-Lht2_CerQue0Xo4
https://www.geeksforgeeks.org/python-program-to-check-armstrong-number/
https://www.geeksforgeeks.org/check-if-a-number-is-palindrome/
O. Assessment-Rubrics
Total
PythonProgramming(4311601)
Date: ……………
Practical No.19: Write a program to find the length of a string.
A. Objective:
E. Practical Outcome(PRo)
A program to find the length of a string
F. Expected Affective domain Outcome(ADos)
Ensure that specifications for program satisfy the requirements
Ensure adequate testing, debugging and review of code.
G. Prerequisite Theory:
This type of problem can be solve using several different approaches, some of them
are:
1. Using len() function
2. Using loop and a counter variable
Syntax:
len(value)
PythonProgramming(4311601)
Parameters:
● Value: the given value you want the length of.
● Return value
It will return an integer value i.e. the length of the given string, or array, or
list or collections.
Various types of Return values:
- Strings:
It returns the number of characters in a string, which includes
punctuation, space, and all types of special characters. However, you
should be very careful while using len of a Null variable.
- Empty:
Empty is a second return call which has zero characters, but it is
always None.
- Collections:
The len built-in returns the number of elements in a collection.
- TypeError:
Len function depends on the type of the variable passed to it. A Non-
Type does not have any built-in support.
- Dictionary:
For the dictionary, each pair is counted as one unit. However, values
and keys are not independent.
# length of string#
usinglen()
s= "Welcome to
India"print("Sizeofstring:",len(
s))
Output:
Sizeofstring:16
PythonProgramming(4311601)
In the second approach, the program will iterate over the entire string using a loop
and will count the characters with the help of a counter variable. The value of the
counter variable will be the length of the string.
Algorithm
Follow the algorithm to understand the approach better.
Step 1- Define a function that will calculate the length of the string
Step 2- Declare and initialize a counter variable
Step 3- Run a loop and iterate over the string
Step 4- Increase the counter variable for every iteration
Step 5- Return counter
Step 6- Call function and print the value
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
def find_string_length_len(string):
length = len(string)
return length
PythonProgramming(4311601)
def find_string_length_loop(string):
counter = 0
for char in string:
counter += 1
return counter
length_using_len = find_string_length_len(input_string)
print("Length of the string using len() function:", length_using_len)
length_using_loop = find_string_length_loop(input_string)
print("Length of the string using a loop and counter variable:", length_using_loop
PythonProgramming(4311601)
L. Input-Output:
Input:
Output:
2: How to find the length of string while loop and slicing concept?
my_string = "Hello, World!"
count = 0
while my_string:
count += 1
my_string = my_string[1:]
print(count)This code accomplishes the same task of finding the length of a string
using a while loop and slicing without the comments
PythonProgramming(4311601)
N. References / Suggestions
https://www.youtube.com/watch?v=bCdZWZppHLo
https://www.youtube.com/watch?v=HXvoj0u9aMw
https://www.geeksforgeeks.org/python-string-length-len/
https://www.programiz.com/python-programming/string
O. Assessment-Rubrics
Total
Date: ……………
Practical No.20: Write a program to reverse words in a given sentence.
A. Objective:
To reverse each word in a given sentence and explore the built in functions of
string length in python.
● Understanding of basic Python syntax and data types (such as strings, lists, and
dictionaries).
● Knowledge of string manipulation in Python, including slicing, indexing, and
concatenation.
● Familiarity with string methods in Python, such as split() and join().
● Ability to iterate over a string or list using loops and comprehension methods.
E. Practical Outcome(PRo)
A program to reverse words in a given sentence.
F. Expected Affective domain Outcome(ADos)
Ensure that specifications for program satisfy the requirements
Ensure adequate testing, debugging and review of code.
G. Prerequisite Theory:
This type of problem can be solve using several different approaches, some of them
are:
separator (optional)- Delimiter at which splits occur. If not provided, the string is
splitted at whitespaces.
maxsplit (optional) - Maximum number of splits. If not provided, there is no limit
on the number of splits.
Syntax: string_name.join(iterable)
Parameters:
#pythoncodetoreversewordsinagivenstring
#inputstring
string= "ilikepythonprogramverymuch"
Output:
muchveryprogrampythonlikei
In the second approach, Follow the below steps to solve the problem:
● Run a for loop to traverse the string and create a temporary string to store the
words
● If the current character is a space then add the current string to the answer and
empty the string
● Else push the character into the string
● Print the answer array in reverse order
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
PythonProgramming(4311601)
K. Source code:
def reverse_words(sentence):
words = sentence.split()
reversed_words = list(reversed(words))
reversed_sentence = ' '.join(reversed_words)
return reversed_sentence
L. Input-Output:
Input:
PythonProgramming(4311601)
text = "This$is$a$string"
parts = text.split('$')
print(parts)
N. References / Suggestions
https://www.youtube.com/watch?v=UVRVF1TtXAo
https://www.geeksforgeeks.org/reverse-words-in-a-given-string/
https://www.programiz.com/python-programming/methods/string/split
O. Assessment-Rubrics
Total
ate: ……………
Practical No.21: Write a program to check if a substring is present in a given string.
A. Objective:
To check if a substring is present in a given sentence or not.
E. Practical Outcome(PRo)
A program to check if a substring is present in a given string.
F. Expected Affective domain Outcome(ADos)
Improve ability to create reliable, and useful python code.
Ensure adequate testing, debugging and review of code.
G. Prerequisite Theory:
Given two strings, check if a substring is there in the given string or not.
Output : No
Checking a substring is one of the most used tasks in python. Python uses many
methods to check a string containing a substring like, find(), index(), count(), etc.
The most efficient and fast method is by using an “in” operator which is used as a
comparison operator.
This type of problem can be solve using several different approaches, some of them
are:
● Checking using the split() method
● Using find() method
● Using the if… in
First split the given string into words and store them in a variable then using the if
condition, check if a substring is present in the given string or not.
#inputstringsstr1andsubstr
string = "I like Python
Programming"substring="Python"#orsubstring=
input()# splittingwords ina givenstring
s=string.split()
#checkingcondition
#ifsubstringispresentinthegiven stringthenitgivesoutputasyesif substring
ins:
print("yes")e
lse:
print("no")
Output:
yes
In the second approach, Follow the below steps to solve the problem:
● Use the find() method to search for the substring in the main string. The find()
method returns the index of the first occurrence of the substring in the main string,
or -1 if the substring is not present in the main string.
● Check the return value of the find() method. If it is not -1, then the substring is
present in the main string. If it is -1, then the substring is not present in the main
string.
● Get the input for the main string and the substring from the user.
● Use the in operator to check if the substring is present in the main string.
● Check the return value of the in operator. If it is True, then the substring is present
in the main string. If it is False, then the substring is not present in the main string.
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
L. Input-Output:
Input:
2: What is the difference between slicing and indexing when working with
substrings in Python?
N. References / Suggestions
https://www.youtube.com/watch?v=xVh59g7EiM0
https://www.digitalocean.com/community/tutorials/python-string-substring
https://www.freecodecamp.org/news/how-to-substring-a-string-in-python/
O. Assessment-Rubrics
Total
ate: ……………
Practical No.22: Write a program to count and display the number of vowels, consonants,
uppercase, lowercase characters in a string.
A. Objective:
To identify and count the number of vowels, consonants, uppercase letters, and
lowercase letters in the string and display the results to the user.
E. Practical Outcome(PRo)
Counting and displaying the number of vowels, consonants, uppercase, and
lowercase characters in a data is a fundamental analysis task that can be applied to
a wide range of use cases.
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. Practice good housekeeping
3. Demonstrate working as a leader/ a team member.
4. Follow ethical practices.
PythonProgramming(4311601)
G. Prerequisite Theory:
isupper()
In Python, isupper() is a built-in method used for string handling. This method
returns True if all characters in the string are uppercase, otherwise, returns “False”.
Parameters:
islower()
The islower() method returns True if all characters in the string are lowercase,
otherwise, returns “False”.
This function is used to check if the argument contains any lowercase characters
such as :
Parameters:
isalpha()
Python String isalpha() method is used to check whether all characters in the
String is an alphabet.
Returns:
Output: True
PythonProgramming(4311601)
Here is a possible algorithm for a program to count and display the number of
vowels, consonants, uppercase, lowercase characters in a string:
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
K. Source code:
def count_characters(string):
vowels_count = 0
consonants_count = 0
uppercase_count = 0
lowercase_count = 0
vowels = set("AEIOUaeiou")
if char.isupper():
uppercase_count += 1
elif char.islower():
lowercase_count += 1
print("Vowels:", vowels_count)
print("Consonants:", consonants_count)
print("Uppercase Characters:", uppercase_count)
print("Lowercase Characters:", lowercase_count)
L. Input-Output:
Output:
Vowels: 5
Consonants: 8
Uppercase Characters: 1
Lowercase Characters: 12
PythonProgramming(4311601)
input_str = "ThisIsInCamelCase"
output_str = camel_to_snake(input_str)
print(output_str)
N. References / Suggestions
https://www.youtube.com/watch?v=ikG9DoACpJM
https://www.geeksforgeeks.org/isupper-islower-lower-upper-python-
applications/?ref=rp
https://codescracker.com/python/program/python-count-characters-in-text-
file.htm
O. Assessment-Rubrics
Total
ate: ……………
Practical No.23: Develop programs to perform the following list operations.
a)To swap given two elements in a list.
b)To find the sum of elements in a list.
A. Objective:
To modify the original list by swapping the elements, and to calculate the total
value of all the elements in the list.
● Familiarity with the concept of temporary variables and their use in swapping
values.
● Ability to handle edge cases, such as swapping elements at the beginning or end
of a list.
● Ability to iterate over all elements in a list and sum them up.
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.
3. Follow ethical practices.
PythonProgramming(4311601)
G. Prerequisite Theory:
pop()
Python list pop() is an inbuilt function in Python that removes and returns the last
value from the List or the given index value.
index (optional) – The value at index is popped out and removed. If the index is not
given, then the last element is popped out and removed.
Return: Returns The last value or the given index value from the list.
Using List pop() method to pop an element at the given index
list1 = [1, 2, 3, 4, 5, 6]
print(list1.pop(), list1)
print(list1.pop(0), list1)
Output:
6 [1, 2, 3, 4, 5]
1 [2, 3, 4, 5]
sum()
Python provides an inbuilt function sum() which sums up the numbers in the list.
Syntax:
sum(iterable, 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 0.
Possible two syntaxes:
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.
sum(a, start)
PythonProgramming(4311601)
numbers=[1,2,3,4,5,1,4,5]
# start =10
Sum = sum(numbers,
10)print(Sum)
output
25
35
output
40
defswapPositions(list,pos1,pos2):
#poppingboththeelementsfromlistfirst_e
le =list.pop(pos1)
second_ele=list.pop(pos2-1)
#insertingineachotherspositionslist.i
nsert(pos1,
second_ele)list.insert(pos2,first_ele)
returnlist
#DriverfunctionList=[2
3,65,19,90]
pos1, pos2= 1,
3print(swapPositions(List,pos1-1,pos2-1))
Output:
[19,65,23,90]
Algorithm
Step 1- Define a function to swap elements with the list sl and positions pos1 and
pos2 as parameters
Step 2- Swap elements sl[pos1] and sl[pos2] using a third variable
Step 3- Return the swapped list
Step 4- Define the list values and the positions of the elements which have to be
swapped
Step 5- Pass the list and (pos1-1) and (pos2-1) in the function (because indexing
starts from 0) and print the result
Algorithm
Step 1-Initialize a variable to hold the sum and set it to 0.
PythonProgramming(4311601)
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
K. Source code:
i)
values = [1, 2, 3, 4, 5]
pos1 = 1
pos2 = 3
result = swap_elements(values, pos1 - 1, pos2 - 1)
print(result)
PythonProgramming(4311601)
ii)
def find_sum(lst):
total_sum = 0
for element in lst:
total_sum += element
return total_sum
values = [1, 2, 3, 4, 5]
sum_of_elements = find_sum(values)
print("The sum of elements in the list is:", sum_of_elements)
L. Input-Output:
Input:
i) ii)
PythonProgramming(4311601)
Output:
The main difference between "remove" and "pop" in a list is that "remove" is used to
remove a specific value from the list and doesn't return the removed value, while "pop" is used to
remove and return an element at a specified index or the last element by default.
my_list = [1, 2, 3, 4, 5]
popped_value = my_list.pop(2) # Removes and returns the element at index 2 (which is 3)
print(popped_value) # 3
print(my_list) # [1, 2, 4, 5]
original_list = [1, 2, 3, 4, 5]
new_list = [x * 2 for x in original_list]
print(new_list) # Output: [2, 4, 6, 8, 10]
PythonProgramming(4311601)
N. References / Suggestions
https://youtu.be/ORVjpSTXtRI
https://youtu.be/FkQyr_N-G3w
https://www.studytonight.com/python-programs/python-program-to-swap-two-
elements-in-a-list
https://www.geeksforgeeks.org/sum-function-python/
O. Assessment-Rubrics
Total
ate: ……………
Practical No.24: Develop programs to perform the following list operations.
a)To check if an element exists in a given list.
b)To find the smallest and largest element in a given list.
A. Objective:
To determine if a specific value is included in the list or not and to identify the
extreme values in the list.
E. Practical Outcome(PRo)
Checking if an element exists in a list and finding the smallest and largest element
in a 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.
3. Follow ethical practices.
G. Prerequisite Theory:
“in” Keyword:
The in keyword has two purposes:
PythonProgramming(4311601)
# Using if statement
if ele in seq:
statement(s)
Example 1: Check if an element exists in the list using the if-else statement
lst=[1,6,3,5,3,4]
#checkingifelement7ispresent#
inthegiven listornot
i=7
#ifelementpresentthenreturn#
existotherwisenotexist
if i in
lst:print("exist
")
else:
print("notexist")
output
notexist
PythonProgramming(4311601)
# Checking if 4 exists in
listfor iintest_list:
if(i ==
4):print("ElementExists")
output
ElementExists
min() Method
Python list method min() returns the elements from the list with minimum value.
Syntax
Following is the syntax for min() method −
min(list)
Parameters
list − This is a list from which min valued element to be returned.
Return Value
This method returns the elements from the list with minimum value.
Example
The following example shows the usage of min() method.
output
min value element
:123minvalueelement:200
max() Method
Python list method max returns the elements from the list with maximum value.
PythonProgramming(4311601)
Syntax
Following is the syntax for max() method −
max(list)
Parameters
list − This is a list from which max valued element to be returned.
Return Value
This method returns the elements from the list with maximum value.
Example
The following example shows the usage of max() method.
output
Max value element
:zaraMaxvalueelement:700
Step 3-For each element, compare it to the current smallest and largest values.
Step 4-If the element is smaller than the current smallest, update smallest to the
element.
Step 5-If the element is larger than the current largest, update largest to the
element.
Step 6-After iterating over all elements, return smallest and largest.
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
K. Source code:
i)
def element_exists(lst, target):
if target in lst:
return True
else:
return False
# Example usage
my_list = [1, 2, 3, 4, 5]
element_to_check = 3
if element_exists(my_list, element_to_check):
print(f"{element_to_check} exists in the list.")
else:
print(f"{element_to_check} does not exist in the list.")
PythonProgramming(4311601)
ii)
def find_smallest_largest(lst):
if len(lst) == 0:
return None, None # Return None for both smallest and largest if the list is
empty
smallest = lst[0]
largest = lst[0]
# Example usage
my_list = [5, 2, 9, 1, 7, 3]
smallest, largest = find_smallest_largest(my_list)
print(f"The smallest element is {smallest}, and the largest element is {largest}.")
PythonProgramming(4311601)
L. Input-Output:
Input:
Output:
return second_largest
# Example usage:
numbers = [10, 5, 8, 20, 15]
result = find_second_largest(numbers)
print("The second largest number is:", result)
PythonProgramming(4311601)
N. References / Suggestions
https://youtu.be/gfldTt9E3kg
https://www.youtube.com/watch?v=ZP9DlljyzMQ
https://youtu.be/d78Iq79g7xU?list=PLgwJf8NK-2e5pY2eB-Lht2_CerQue0Xo4
https://www.geeksforgeeks.org/check-if-element-exists-in-list-in-python/
PythonProgramming(4311601)
https://www.geeksforgeeks.org/python-program-to-find-smallest-number-in-a-
list/
https://medium.com/programminginpython-com/python-program-to-find-the-
largest-and-smallest-number-in-a-list-fd8fac8aba08
https://www.tutorialspoint.com/python/list_min.htm
O. Assessment-Rubrics
Total
ate: ……………
Practical No.25:
a) Given a list saved in variable: a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]. 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.
b) Create a list containing the square of all odd numbers from range 1 to 10.
c) Create a list of prime and non-prime numbers in range 1 to 50.
A. Objective:
To filter out the odd elements from the list and create a new list containing only
the even elements
To create a list of the squares of odd numbers within a specific range
To identify and distinguish between prime and non-prime numbers within a
specific range.
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.
3. Follow ethical practices.
PythonProgramming(4311601)
G. Prerequisite Theory:
list comprehension
A Python list comprehension consists of brackets containing the expression, which
is executed for each element along with the for loop to iterate over each element
in the Python list.
Python List comprehension provides a much more short syntax for creating a new
list based on the values of an existing list.
#UsinglistcomprehensiontoiteratethroughloopList
=[characterfor character in[1, 2,3]]
# Displaying
listprint(List)
output
[1, 2,3]
list =[iforiinrange(11)ifi%2
!=0]print(list)
output
[1, 3,5,7,9]
PythonProgramming(4311601)
output
[0,10,20,30,40,50,60,70, 80,90]
obj=["Even"if i%2==0else"Odd"foriinrange(10)]print(obj)
output
['Even','Odd','Even','Odd','Even','Odd','Even','Odd','Even','Odd']
Algorithm
Step 1-Use a list comprehension to filter out the odd elements from the original
list and create a new list containing only the even elements.
Step 2-Return the new list containing only the even elements.
● Create a list containing the square of all odd numbers from range 1 to 10.
Algorithm
Step 1- Use a list comprehension to iterate through each number from 1 to 10 and
filter out the even numbers using an if statement.
Step 2- Square each odd number using the power operator ** and add it to the
new list.
Step 3- Return the list containing the squares of odd numbers.
PythonProgramming(4311601)
Algorithm
Step 1- Use a nested list comprehension to iterate through each number from 1 to
50 and check if it's prime or not using another nested list comprehension and the
modulo operator.
Step 2- Append the prime numbers to one list and the non-prime numbers to
another list.
Step 3- Return both lists containing the prime and non-prime numbers.
I. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantity
No. /Components/Trainer kit
1 Computer system OS: Windows 7 or higher Ver., 01
macOS, and Linux, with 4GB or
higher RAM
2 Python IDEs Open Source : IDLE, Jupyter 01
Python versions: 2.7.X, 3.6.X
i)
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
even_elements = [x for x in a if x % 2 == 0]
print(even_elements)
PythonProgramming(4311601)
ii)
# Using a list comprehension to create a list of squares of odd numbers
squares_of_odd_numbers = [x**2 for x in range(1, 11) if x % 2 != 0]
L. Input-Output:
Input:
i) ii) iii)
Output:
i) ii) iii)
2: Write list comprehension to find all of the numbers from 1-1000 that are
divisible by 7
N. References / Suggestions
https://youtu.be/TGaKzl6p4nA?list=PL98qAXLA6aftqPGddFjJ59m71F96ZPwD4
https://youtu.be/1HlyKKiGg-4
https://www.programiz.com/python-programming/list-comprehension
https://www.w3schools.com/python/python_lists_comprehension.asp
O. Assessment-Rubrics
Total
Python Programming
(4311601)
Lab manuals are prepared by
Dr. Lataben J Gadhavi
Lecturer, Information Technology Department
Government Polytechnic Gandhinagar
Branch Coordinator
Shri.Nandu Fatak
Head of Department, Information Technology Department
Government Polytechnic for Girls
Committee Chairman
Shri R. D. Raghani
(HOD-EC)
Principal (I/C)
Government Polytechnic, Gandhinagar