0% found this document useful (0 votes)
20 views

Python Programming Lab Syllabus 23-24

Uploaded by

Anirudh Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Python Programming Lab Syllabus 23-24

Uploaded by

Anirudh Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Jodhpur Institute of Engineering & Technology

SYLLABUS

II – Semester

Common to all branches of UG Engineering

2FY3-23: Python Programming Lab

Credit: 1 Max. Marks: 50 (IA: 30, ETE: 20)


0L+0T + 2P

S.No. CONTENTS EXERCISES*


1 Basics of Python 1. Write a Python commands to get the Python
version you are using.
2. Write a Python commands to display the
current date and time.
3. Write a Python program which accepts the
radius of a circle from the user and compute
the area.
4. Write a Python program that accepts an
integer (n) and computes the value of n+ nn+
nnn.
Sample value of n is 5 Expected Result : 615
5. Write a Python program to calculate
number of days between two dates. Sample
dates : (2014, 7, 2), (2014, 7, 11)
Expected output : 9 days
6. Write a Python program to swap two
variables
2 Decision Statement, Loops 1.Write a Python program to get the difference
between a given number and 17, if the number
is greater than 17 return double the absolute
difference.
2.Write a Python program to test whether the
input number is near 100 or 1000 or 2000.
3.Write a Python program to calculate the sum
of three given numbers, if the values are equal
then return three times of their sum.
4.Write a Python program to compute the
greatest common divisor (GCD) of two
positive integers.
5.Write a Python program to calculate the sum
of the digits in an integer.
6.Write a Python function to find the
maximum and minimum numbers from a
sequence of numbers.
Note: Do not use built-in function
3 String data type 1. Write a Python program that takes a string
input and displays the string in a specific
format.
Sample String:" Twinkle, twinkle, little star,
How I wonder what you are!
Output: Twinkle, twinkle, little star, How I
wonder what you are!
2. Write a Python program to accept a
filename from the user and print its extension.
Sample input : abc.py Output: py
Write a Python program to get a new string
from a given string where
"Is" has been added to the front. If the given
string already begins with
"Is" then return the string unchanged
4 Data Structures :List, Tuple, 1.Write a Python program which accepts a
Dictionary, Set sequence of commaseparated numbers from
user and generate a list and a tuple with those
numbers.
Sample data : 3, 5, 7, 23
Output :
List : ['3', ' 5', ' 7', ' 23']
Tuple : ('3', ' 5', ' 7', ' 23')
2.Write a Python program that counts the
frequency of a number x in a given list of n
elements.
3. Write a Python program to print all even
numbers from a given list of numbers in the
same order and stop the printing the numbers
that come after the number x in the sequence.
5 Data Structures : Dictionary, Set 1. Write a Python program that takes input in
two sets [set A and set B] and prints out
elements belonging to set A which are not
present in set B.
2. Write a Python program to create a
dictionary from a string and display in table
format.
3. Write a Python program to print all unique
values in a dictionary
6 Functions PART-1 1.Write a Python program to reverse a string.
Sample String: "1234abcd" Expected Output:
"dcba4321"
2.Write a Python function that takes a list and
returns a new list with unique elements of the
first list. Sample List :[1,2,3,3,3,3,4,5] Unique
List : [1, 2, 3, 4, 5]
3.Write a Python program that accepts a
hyphen-separated sequence of words as input
and prints the words in a hyphen-separated
sequence after sorting them alphabetically.
Sample Items: green-red-yellow-black-white
Expected Result: black-green-red-white-
yellow
7 Functions PART -2 1.Write a Python program to make a chain of
function decorators (bold, italic, underline
etc.) in Python.
2.Write a Python program that squares and
cubes every number in a given list of integers
using Lambda.
3.Write a Python program to find if a given
string starts with a given character using
Lambda.
8 File handling 1.Write a Python program that reads an entire
text file.
2. Write a Python program that reads first n
lines and last n lines of a file
3. Write a Python program that reads a file
line by line and stores it into a list.
4. Write a Python program that counts the
number of lines, words, and frequency of each
character in a text file.
5. Write a Python program that copy the
contents of a file to another file.
6. Write a Python program that removes
newline characters from a file.
9 Regular Expressions 1. Write a Python program to check that a
string contains only a certain set of characters
(in this case a-z, A-Z and 0-9)
2. Write a Python program that matches a
string that has an a followed by zero or more
b's
3. Write a Python program to find sequences
of lowercase letters joined with a underscore
4. Write a Python program where a string will
start with a specific number.
10 Introduction to OOP 1. Write a Python class named Rectangle
constructed by a length and width and a
method which will compute the area of a
rectangle.
2. Write a Python class named Circle
constructed by a radius and two methods
which will compute the area and the perimeter
of a circle.
3. Write a Python class to implement pow(x,
n)
4. Write a Python class which has two
methods get String and print String. get String
accept a string from the user and print String
print the string in upper case

TEXT BOOK

1. Let Us Python: Yashwant Kanetkar, Aditya Kanetkar 3rd edition bpb publication

REFERENCES BOOKS:
1. Core Python Programming Textbook by Wesley Chun Prentice Hall.

2. Python: The Complete Reference by Martin C. Brown Mac Graw-Hill, Oxford

You might also like