sction a
sction a
Thereafter, it increments all even numbers by 1 and decrements all odd numbers by 1.
Example:
L=[10,21,30,40,35,55]
L=[11,20,31,41,34,54]
Program : 29/04/2024
Output:
2. Write a user defined function in Python named Puzzle(W,N) which takes the
argument W as an argument W as an English word and N as an integer and returns the
string where every Nth alphabet of the word W is replaced with an underscore(“_”). For
Example: If W contains the word “TELEVISION” and N is 3, then the function should
return the string “TE_EV_SI_N”.
Program : 10/05/2024
Output:
3. Write a menu driven Python Program to do the following
b. A user defined function DisplayPython() to read and display the lines from a text file
PYTHON.TXT which starts with the word ‘The’.
Program: 10/05/2024
4. Write a menu driven Python Program to do the following
a. A user defined function CreateFile() to create a text file Details.txt with multiple lines
of text
b. Write a Python function DigWords() that count and display the words ending with digit
in a text file Details.txt
program: 17/05/2024
Output:
5. Write a menu driven Python Program to do the following
a. A user defined function CreateFile() to create a text file SAMPLE.TXT with multiple
lines of text
b. Write a function Change() to read the text file SAMPLE.TXT line by line and display
each word separated by#
program: 17/05/2024
Output:
6. Write a menu driven Python Program to do the following
a. A user defined function CreateFile() to create a text file STORY.TXT with multiple lines
of text
b. Write a function showlines() which reads the contents of the file STORY.TXT and
display every sentence in separate line
program: 24/05/2024
Output:
7. Write a menu driven Python Program to do the following
a. A user defined function CreateFile() to create a text file SAMPLE.TXT with multiple
lines of text
b. write a function count() to read the text file SAMPLE.TXT and display the number of
vowels/ consonants/ uppercase/ lowercase and other characters in the file.
Program: 24/05/2024
Output:
8. Write a menu driven Python Program to do the following
a. A user defined function CreateFile() to create a text file CBSE.TXT with multiple lines
of text
b. Write the definition of a function Long_Line() in Python, which should reads the
contents of the text file "CBSE.TXT" and display the lines with more than 5 words in it.
Program: 31/05/2024
Output:
9. Write a menu driven Python Program to do the following
a. A user defined function CreateFile() to create a text file SAMPLE1.TXT with multiple
line of text
b. Write a user defined function RMlines_A() to remove all the lines that contain the
character 'a' in SAMPLE1.TXT and write it to another file SAMPLE2.TXT.
program: 31/05/2024
Output:
10.Write a menu driven Python Program to do the following
program: 3/06/2024
Output:
11.Consider a file, SPORT.DAT, containing records of the following structure:
following
b. Write a function, copyData(), that reads contents from the file SPORT.DAT and copies
the records with Sport name as “Basket Ball” to the file named BASKET.DAT. The
function should return the total number of records copied to the file BASKET.DAT.
Program: 07/06/2024
Output:
12. A Binary file, CINEMA.DAT has the following structure: {MNO:[MNAME, MTYPE]}
Where MNO – Movie Number, MNAME – Movie Name, MTYPE is Movie Type Write a
menu driven Python Program to do the following
b. Write a user defined function, findType(mtype), that accepts mtype as parameter and
displays all the records from the binary file CINEMA.DAT, that have the value of Movie
Type as mtype.
Program: 11/06/2024
Output:
13.Consider the binary file, “Items.dat” containing records stored in the
format:{item_id:[item_name,amount]} Write a menu driven Python Program to do the
following
b. Write a function Copy_New() that copies all records whose amount is greater than
1000 to NEW_ITEMS.DAT
program: 14/06/2024
output:
14. A csv file “Book.csv” has structure [B_ID, B_Name, Author, Price]. Write a menu
driven Python Program to do the following
a. A user defined function Add_Book() :Takes the details of the books and add them to
“Book.csv”. Each record consists of a list with field elements such as B_ID, B_Name,
Author and Price respectively. The column headings should also be added on top of the
csv file.
Program: 20/06/2024
Output:
15. Write a menu driven Python Program to do the following. A user defined function
Program: 27/06/2024
Output:
16. Write a menu driven program to implement STACK operations on a stack with train
names.
b. Delete(Trains)—delete an element from the stack, check whether the stack is empty
or not before deletion
program: 03/09/2024
17. Write a menu-driven program to implement STACK operations on a list, NList
contains following record as list elements: [City, Country, distance from Delhi]. Each of
these records are nested together to form a nested list. Write the following user defined
functions in Python to perform the specified operations on the stack named travel.
a. Push_element(NList): It takes the nested list as an argument and pushes a list object
containing name of the city and country, which are not in India and distance is less than
3500 km from Delhi.
b. Pop_element(): It pops the objects from the stack and displays them. Also, the
function should display “Stack Empty” when there are no elements in the stack
program: 10/09/2024
Output:
18. Write a menu-driven program to implement STACK operations
Program: 12/09/2024
Output:
19. Alam has a list containing 10 integers. You need to help him create a menu driven
program with separate user defined functions to perform the following operations based
on this list.
a. PushEven(L): Traverse the content of the list, L and push the even numbers into a
stack.
b. Pop() :pop and display the content of the stack. The function should also return None
when there are no more numbers left in the stack.
Program: 16/09/2024
Output:
20. Consider a list named Nums which contains random integers. Write the following
user defined functions in Python and perform the specified operations on a stack
named BigNums.
a. PushBig() : It checks every number from the list Nums and pushes all such numbers
which have 5 or more digits into the stack, BigNums.
b. PopBig() : It pops the numbers from the stack, BigNums and displays them. The
function should also display "Stack Empty" when there are no more numbers left in the
stack.
Program: 20/09/2024
Output: