Programming_PWP
Programming_PWP
2 Write a program to create class EMPLOYEE with ID and NAME and display its
contents.
3 Write a program for importing module for addition and substraction of two
numbers.
4 Write a program to create dictionary of students that includes their ROLL NO.
and NAME.
i) Add three students in above dictionary
ii) Update name = ‘Shreyas’ of ROLL NO = 2
iii) Delete information of ROLL NO = 1
5 Write a program illustrating use of user defined package in python.
6 a) Write the output of the following :
i) >>> a = [ 2, 5, 1, 3, 6, 9, 7 ]
>>> a [ 2 : 6 ] = [ 2, 4, 9, 0 ]
>>> print (a)
ii) >>> b = [ “Hello” , “Good” ]
>>> b. append ( “python” )
>>> print (b)
iii)>>> t1 = [ 3, 5, 6, 7 ]
>>> print ( t1 [2] )
>>> print ( t1 [–1] )
>>> print ( t1 [2 :] )
>>> print ( t1 [ : ] )
7 Write a program to open a file in write mode and append some contents at the
end of file.
8 Write a program to implement the concept of inheritance in python.
9 Write down the output of the following Python code
>>>indices=['zero','one','two','three','four','five']
i) >>>indices[:4]
ii) >>>indices[:-2]
10 Write a Python program to find the factorial of a number provided by the user.
11 Write a python program to input any two tuples and interchange the tuple
variables.
12 Write a program to show user defined exception in Python.
13 Write a Python Program to check if a string is palindrome or not.
14 Write a Python program to calculate sum of digit of given number using function.
15 Write a Python Program to accept values from user in a list and find the largest
number and smallest number in a list.
16 Write python program to display output like.
17 Write python program using module, show how to write and use module by
importing it.
18 T = (‘spam’, ‘Spam’, ‘SPAM!’, ‘SaPm’)
print (T [2] )
print (T [-2] )
print (T [2:] )
print (List (T) )
19 WAP to read contents of first.txt file and write same content in second.txt file
20 Write a program illustrating use of user defined package in python.
21 Write a program to create class student with Roll no. and Name and display its
contents.
22 Write program to implement concept of inheritance in python
23 Print the following pattern using loop: