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

python programming list1

The document outlines a series of programming tasks and concepts in Python, including creating classes, handling exceptions, file operations, and data structures like dictionaries and sets. It also covers control flow statements, user-defined exceptions, and various built-in functions. Each task requires writing code to demonstrate specific programming principles and functionalities.

Uploaded by

gavalimanasi1
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

python programming list1

The document outlines a series of programming tasks and concepts in Python, including creating classes, handling exceptions, file operations, and data structures like dictionaries and sets. It also covers control flow statements, user-defined exceptions, and various built-in functions. Each task requires writing code to demonstrate specific programming principles and functionalities.

Uploaded by

gavalimanasi1
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

1)Write a program to print following:

12

123

1234

2)Write a program to create class EMPLOYEE with ID and NAME and display
its contents.

3) 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 =

iii) Delete information of ROLL NO = 1

4) Explain decision making statements If- else, if- elif- else with example.

5)Write the output of the following output


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 (t 1 [2])
>>> print (t 1 [–1])
>>> print (t 1 [2 :])
>>> print (t 1 [:])
6) Write a program for package Numpy with example.(Matrix
Addition,subtraction)

7) Write a program to implement the concept of inheritance in python

8) Explain Try-except block used in exception handling in python with


example.

9) Write a program to open a file in write mode and append some contents at
the end of file.

10)Write down the output of the following Python code


>>>indices=['zero','one','two','three','four','five'

1)>>>indices[:4]
2)>>>indices[:-2]

11)Write a Python program to find the factorial of a number provided by the


user.

12)Write a python program to input any two tuples and interchange the tuple
variables.

13)Write a program about readline() and readlines() functions in file-


handling.

14) Write a program 'Self' Parameter .

15)Write a program to show user defined exception in Python


16) Write a Python Program to check if a string is palindrome or not.

17) Write a Python program to calculate sum of digit of given number using
function.

18) Write a Python Program to accept values from user in a list and find the
largest number and smallest number in a list

19)Design a class student with data members : name, roll no., department,
mobile no. Create suitable methods for reading and printing student
information.

20)Write a program for inheritance in Python.

21)Write python program to display output like

2
4 6 8
10 12 14 16 18

22)Write python program using module, show how to write and use module
by importing it.

T = (‘spam’, ‘Spam’, ‘SPAM!’, ‘SaPm’)


print (T[2])
print (T[-2])
print (T[2:])
print (List (T))

23) Write a Python program to create user defined exception that will check
whether the password is correct or not.
24)Write a program for overloading and overriding in python.

25)WAP to read contents of first.txt file and write same content in second.txt
file.

26)Write a program for seek ( ) and tell ( ) function for file pointer
manipulation in python .

27)Write a program to create class student with Roll no. and Name and
display its contents.

28)Write a program for four built-in functions on set.

29)Write a program for bitwise operators in Python .

30)Write python program to illustrate if else ladder.

31)Write a program for any four operation of List.

32)Write Python code for finding greatest among four numbers

33)Write python code to count frequency of each characters in a given file

34)Design a class student with data members; Name, roll number address
Create suitable method for reading and printing students details.

35)Create a parent class named Animals and a child class Herbivorous which
will extend the class Animal. In the child class Herbivorous over side the
method feed ( ). Create a object.
36)Print the following pattern using loop:

1010101
10101
101
1

37)Write python program to perform following operations on set

. i) Create set of five elements

ii) Access set elements

iii)Update set by adding one element

iv) Remove one element from set

38)What is the output of the following program?

a) dict1 = {‘Google’ : 1, ‘Facebook’ : 2, ‘Microsoft’ :


b) dict2 = {‘GFG’ : 1, ‘Microsoft’ : 2, ‘Youtube’ :
c) dict1⋅update(dict2);
for key, values in dictl⋅items( ):
print (key, values)

39) Write a python program that takes a number and checks whether it is a
palindrome.

40) Write a python program to create a user defined module that will ask
your program name and display the name of the program.

41)Write a python program takes in a number and find the sum of digits in a
number.

42)Write a program function that accepts a string and calculate the number of
uppercase letters and lower case letters.
43)Write a program function that accepts a string and calculate the number of
uppercase letters and lower case letters

44)Write a python program to generate five random integers between 10 and


50 using numpy library.

45)Write a Python program to create a class ‘Diploma’ having a method


‘getdiploma’ that prints “I got a diploma”. It has two subclasses namely ‘CO’
and ‘IF’ each having a method with the same name that prints “I am with CO
diploma” and ‘I am with IF diploma’ respectively. Call the method by creating
an object of each of the three classes

46) Write a Python program to create user defined exception that will check
whether the password is correct or not.

47) Write a Python program to check for zero division errors exception.

48)Design a class student with data members; Name, Roll No., Address. Create
suitable method for reading and printing students detail

49)Explain Try-except-else-finally block used in exception handling in Python


with example.
50)Write a Python program to create a class ‘Diploma’ having a method ‘getdiploma’ that
prints “I got a diploma”. It has two subclasses namely ‘CO’ and ‘IF’ each having a method
with the same name that prints “I am with CO diploma” and ‘I am with IF diploma’
respectively. Call the method by creating an object of each of the three classes

You might also like