You are on page 1of 18

Practical 1

Aim: Write a python program to implement various file operations.

a) Program to read a file.


Source Code:

Output:

b) Program to append a file.


Source Code:

Output:

1
c) Program to write a file.
Source Code:

Output:

d) Program to remove a file.


Source Code:

Output:
2
Practical 2
Aim: Write a python program to demonstrate use of regular expression for
suitable examples.

a) Match()
Source Code:

Output:

b) Fullmatch()

3
Source Code:

Output:

c) Search()
Source Code:

Output:

d) Findall()
4
Source Code:

Output:

e) Finditer()
Source Code:

Output:

f) Sub()

5
Source Code:

Output:

g) Subn()
Source Code:

Output:

6
h) Split()
Source Code:

Output:

i) Compile()
Source Code:

Output:

Practical 3
Aim: Write a program to demonstrate concept of threading and
multitasking.
a) Program to create Threading after a few time. Source
Code:

7
Output:

b) Program to display cube and square of a number.


Source Code:

Output:

c) Program to create Multithreading after a few time.


Source Code:

8
Output:

9
Practical 4
Aim: Write a python program to create application which uses date and
time in python.
a) Program to display current date and time using
now() attribute. Source Code:

Output:

10
b) Program to display today’s date
Source Code:

Output:

c) Program to display today’s time

11
Source Code:

Output:

d) Program to compare two dates


Source Code:

Output:

12
Practical 5
Aim: Write a python program to demonstrate different types of exception
handling.
a) Program to find IO ERROR and Value Error by using try except
method.

13
Source Code:

Output:

b) Program to find IO ERROR by using try except else method. Source


Code:

Output:

c) Program to use try , except and finally method

14
Source Code:

Output:

d) Program to use try, except, else method.


Source Code:

Output:

Practical 6
Aim: Write a python program to implement concepts of OOP such as
a) Inheritance

15
OUTPUT:

16
b) Polymorphism
Source Code:

Output:

17
Practical 7
Aim: Write a python program to implement concepts of OOP such as
a) Abstract methods and classes

OUTPUT:

18

You might also like