INTRODUCTION TO PYTHON PROGRAMMING
BPLCK105B (2022 SCHEME)
MODULE-1
1.List the salient features of Python programming language.
Explain the following with an example
a) print( )
b) input( )
c) len( )
2.Explain the following with an example
a) elif
b) for
c)while
d) break
e) continue
f) if
g) else
3.What are functions? Explain python function with parameters
and return statement.
4.Define exception handling. How exception are handled in
python? Write a program to solve divide by zero exception.
5.Explain Local and Global scope with variables for each.
6.Explain string concatenation and string replication operation
with an example.
7.What are user defined function? How can we pass parameters in
user defined function? Explain with suitable example.
8.Develop a program to generate Fibonacci sequence of Length(N).
Read N from the console.
9.Develop a program to read the name and year of birth of a
person. Print whether the person is a senior citizen or not.
10.Develop a program to compute binomial coefficient (Given N
and R).
MODULE-2
1.Explain the use in and not in operator in list with example.
2.What is List? Explain the Indexing, slicing, index( ), append( ),
remove( ), pop( ) and how the list can be converted to tuple.
Insert( ) and sort( ) with suitable example
3.Write about Mutable and Immutable data type in list.
4.Explain all the list methods with example and also explain List
concatenation and List replication.
5.Differentiate between
a) tuple and list
b) list and dictionary
6.Explain the example get( ), keep( ), values( ) and items( )
methods in a dictionary.
7.Explain set( ) and setdefault( ) method in a dictionary.
8.Read N numbers from the console and create a list. Develop
program to compute and print mean, variance and standard
deviation with messages.
9.Develop a program to read the student details like Name, USN
and Marks in three subjects. Display the student details, total
marks and percentage with suitable messages.
MODULE-3
1.IExplain the concept of file handling. Illustrate with example
opening of a file with open( ) function, reading the contents of the
file with read( ) and writing to files with write( ).
2.Explain how to save variable with the shelve module.
3.Explain the built-in methods available for working with string
along with example.
4.Explain join( ) and split( ) methods with example.
5.Explain the concept of file path. Also discuss absolute and
relative file path.
6.Explain the role of shelve module in working with files.
7.Explain Password locker project, illustrate the different steps in
the project Adding Bullets to Wiki markup.
8.Explain in and not in operators in string and give a explanation
about pyperclip module.
9.Read a multi-digit number( as chars) from console. Develop a
program to print the frequency of each digit with suitable
example.
10.Develop a program to sort the contents of a text file and write
the sorted contents into a separate text file.
MODULE-4
1.What are assertions? Write the contents of an assert statement.
Explain them with example.
2.Explain are the different methods of file operations supported in
the python shutil module.
3.Explain the buttons in the Debug control window.
4.Write a note on raising exception.
5.Illustrate the logging levels in python.
6.Explain the following file operations in Python with suitable
example
a) Copying files and folders
b) Moving files and folders
c) Permanently deleting files and folders.
7.List out the difference between the shutil.copy( ) and
shutil.copytree( )
8.What is meant by compressing files? Explain reading, extracting,
and creating ZIP files with code snippet.
9.Develop a program with a function named DivExp which takes
Two parameters a, b and returns a value c(c = a/b), write suitable
assertion for a > 0 in function DivExp and raise an exception for
when b = 0. Develop a suitable program which reads two values
from the console and calls a function DivExp.
10.Develop a program to backing up a given Folder into ZIP File by
using relevant modules and suitable methods.
MODULE-5
1.Explain about class and objects and attributes with an example.
2.Explain about pure function and modifier.
3.Explain the concept of prototyping v/s planning.
4.Explain _init_ and _str_ methods with examples.
5.Explain the concept of inheritance and class diagrams with
example.
6.What is Polymorphism? Demonstrate polymorphism with
functions to find histogram to count the numbers of times each
letters appears in a word and in sentence.
7.Write Deck method to add, remove shuffle and sort cards, with
illustrating the problem.
8.Define a class and object, construct the class called rectangle and
initialize it with height = 100, width = 200, starting point as (x = 0,
y = 0). Write a program to display the center point co-ordinates of
a rectangle.
9.Define a function which takes two objects representing complex
numbers and returns new complex number with a addition of two
complex numbers. Define a suitable class ‘Complex’ to represent
the complex number. Develop a program to read N(N > = 2)
complex numbers and to compute the addition of N complex
numbers.