Computer Engineering Department
SEMESTER: 3rd
SUBJECT: Python Programming
SUBJECT CODE: 2010206304
Name of Student: ______________________________
Enrollment No: ______________________________
Faculty Name: ______________________________
FACULTY OF ENGINEERING &
TECHNOLOGY
CERTIFICATE
This is to certify that Mr. / Ms. …....................................................................................................................
…………………………………… of class...........................................Enrollment No……………………………………………….
has satisfactorily submitted his / her term works in subject ………………………………………………........................
for the term ending in……………………………………………………………………………….
Date:
Sign of Teacher Sign of H.O.D
Subject: Python Programming- 2010206304
Branch: Computer Engineering (B.Tech)
Semester: 3rd
Teaching & Examination scheme:
Teaching Scheme Total Credit
Examination Scheme
(in Hours) (L+T+P)
L T P Credit Practical Marks
Total Marks
Internal External
0 0 4 2
2 3
50
0 0
Legends: L – Lecture; T – Tutorial; P – Practical
Course Outcomes:
Develop essential programming skills in computer programming concepts like data
CO-1
types, containers
Apply the basics of programming in the Python language
CO-2
CO-3 Solve coding tasks related conditional execution, loops
Solve coding tasks related to the fundamental notions and techniques used in object-
CO-4
oriented programming
CO-5 Be able to understand the various data structures available in Python programming
language and apply them in solving computational problems.
LABORATORY REGULATIONS
1. Punctuality: Arrive on time for every lab session.
2. Mobile Phones: Must be switched off or on silent mode.
3. Attendance: Attendance is compulsory. Any absence should be notified in
advance.
4. Lab Notebook:
o Record observations directly into your notebook.
o Each student maintains an individual notebook.
o Obtain your instructor’s signature for at least one observation of each
experiment.
5. Time Management: Complete all experimental work within the allocated lab
hours.
6. Reporting: Submit the complete report in the subsequent lab session.
Index
Sr. Practical CO Page Date Marks Sign
No. No (10)
Write a program that asks the user for a weight in CO1
1 kilograms and converts it to pounds. There are 2.2
pounds in a kilogram.
Write a program that asks the user to enter three CO2
numbers (use three separate input statements). Create
2 variables called total and average that hold the sum and
average of the three numbers and print out the values
of total and average.
Write a program that uses a for loop to print the CO2
3
numbers 8, 11, 14, 17, 20, . . . , 83, 86, 89.
Write a program that asks the user for their name and CO2
4 how many times to print it. The program should print
out the user’s name the specified number of times.
Use a for loop to print a triangle like the one below. CO2
Allow the user to specify how high the triangle should
be.
*
5
**
***
****
Generate a random number between 1 and 10. Ask CO2
6 the user to guess the number and print a message
based on whether they get it right or not.
Write a program that asks the user for two numbers CO2
7 and prints Close if the numbers are within .001 of each
other and Not close otherwise.
Write a program that asks the user to enter a word and CO2
8
prints out whether that word contains any vowels.
Write a program that asks the user to enter two strings CO4
of the same length. The program should then check to
see if the strings are of the same length. If they are
not, the program should print an appropriate message
9
and exit. If they are of the same length, the program
should alternate the characters of the two strings. For
example, if the user enters abcde and ABCDE the
program should print out AaBbCcDdEe.
Write a program that asks the user for a large integer CO2
and inserts commas into it according to the standard
10 American convention for commas in large numbers.
For instance, if the user enters 1000000, the output
should be 1,000,000.
In algebraic expressions, the symbol for
multiplication is often left out, as in 3x+4y or 3(x+5).
Computers prefer those expressions to include the
11 multiplication symbol, like 3*x+4*y or 3*(x+5).
Write a program that asks the user for an algebraic
expression and then inserts multiplication symbols
where appropriate.
Write a program that generates a list of 20 random CO3
numbers between 1 and 100.
(a) Print the list.
(b) Print the average of the elements in the list.
12
(c) Print the largest and smallest values in the list.
(d) Print the second largest and second smallest entries
in the list
(e) Print how many even numbers are in the list.
Write a program that removes any repeated items CO3
from a list so that each item appears at most once. For
13
instance, the list [1,1,2,3,4,3,0,0] would become
[1,2,3,4,0].
Write a function called sum_digits that is given an CO4
14
integer num and returns the sum of the digits of num.
Write a function called merge that takes two already CO4
sorted lists of possibly different lengths, and merges
them into a single sorted list.
15
(a) Do this using the sort method.
(b) Do this without using the sort method.
Write a program that reads a file consisting of email CO4
addresses, each on its own line. Your program should
16
print out a string consisting of those email addresses
separated by semicolons.
Write a program that reads a list of temperatures from CO5
17 a file called temps.txt, converts those temperatures to
Fahrenheit, and writes the results to a file called
ftemps.txt.
18 Write a Python class to implement pow(x, n). CO5
19 Write a Python class to reverse a string word by word. CO5
20 Write a program to demonstrate Try/except/else. CO6
Write a program to demonstrate try/finally and CO6
21
with/as.
Evaluation Sheet
3 Marks 3 Marks 2 Marks 1 Mark 1 Mark
Total
Practi R1 R2 Marks Sign of
calList R3 R4 (Out of faculty
R5
Accurac Understanding Engageme Documentatio 10)
Time
y & Explanation nt n
10
11
12
13
14
15
16
17
18
19
20
21
Python Programming (2010206304) 2207020601008
Practical 1
Aim: Write a program that asks the user for a weight in kilograms and converts it to pounds. There are
2.2 pounds in a kilogram.
Input:
kg = int(input("Enter weight in KG: "))
pound = 2.205
result = kg * pound
print("result is :", result)
Output:
Enter weight in KG: 5
result is : 11.025
BAIT 1
Python Programming (2010206304) 2207020601008
Assessment:
Satisfactor
Total Exceptional Developing Limited Marks
Criteria y
Marks (3 - Marks) (1-Mark) (1-Mark) Obtained
(2 - Marks)
Accurately 1-2 errors /3-5 errors/ More than 5
Accuracy 3
done mistake mistake errors
Fully under Partially Partially
Understand
Understanding stood and understood understood
3 but cannot
& Explanation explain and can and cannot
explain
perfectly explain explain
Watched other
Present but
Performed students
Performed not
Practical performing
Engagement 2 Practical participate
with other practical but
him/her self in
help not tried him/
performance
her self
Document is Missing
Documented Poor writing,
Documentatio proper, but output.
1 properly, no missing
n presentation Improper
error output
is average documentation
Complete Complete Work submit
Submit after 2
Time 1 within a within two after 3
weeks
week weeks weeks.
Total
Faculty Signature with Date
BAIT 2