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

Python Program(0) Removed Removed

Uploaded by

arunkesarwani464
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Python Program(0) Removed Removed

Uploaded by

arunkesarwani464
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Q1).

Read a text file line by line and


display each word separated by a
“#”.

INPUT-

OUTPUT-

(1) Nizam Uddin Siddiqui


Q2) Read a text file and display the number
of vowels / consonants /upper case / lower
case character in the file.
INPUT

OUTPUT

Nizam Uddin Siddiqui


(2)
Q3) Remove all the lines that contain the
character ‘a’ in a file and write it to another
file.
INPUT

OUTPUT

Nizam Uddin Siddiqui

(3)
Q4) Write a menu driven program to perform
arithmetic operation (+,-,*,/) based on the user
choice.
INPUT

(4)
Nizam Uddin Siddiqui
(5) Nizam Uddin Siddiqui
Q5) Create a binary file with roll number,
name and marks. Input a roll number and
update the marks.
INPUT

Nizam Uddin Siddiqui


(6)
OUTPUT

(7) Nizam Uddin Siddiqui


Q6) Create a CSV file by entering user’s id and
password, read and search the password for given
user-id.
INPUT

(8) Nizam Uddin Siddiqui


OUTPUT

(9) Nizam Uddin Siddiqui


Q7). Write a random number generator that
generates random number between 1 and 6
(stimulates a dice).

INPUT

Nizam Uddin Siddiqui


(10)
OUTPUT

Nizam Uddin Siddiqui


(11)
Q8) Write a function ET count()in python which should
read each character of text file”TESTFILE.TXT” and
then count and display the count of occurrence of
alphabets E and T individually (including small case e
and t too).
INPUT

OUTPUT

Nizam Uddin Siddiqui


(12)
Q9) Write a program that copies a text file
“source.txt” onto “target.txt” barring the lines
starting with a”@” sign.
INPUT

(13) Nizam Uddin Siddiqui


OUTPUT

Nizam Uddin Siddiqui


(14)
Q10). Write a python program to
implement returning values from
function.
INPUT

OUTPUT

Nizam Uddin Siddiqui


(15)
Q11) .Write a function in python that count
numbers of ‘Me’ or ‘My’ words present in a text file.
”Story.txt”. If the “Story.txt” contents are as follows
– My first book was ‘Me and My Family ‘ . it gave me
the chance to be known to the world.

INPUT

OUTPUT

Nizam Uddin Siddiqui

(16)
Q12). Write a program to create a CSV file to
store student data (Roll No., Name, Marks).
Obtain data from user and write 5 records into
the file.

INPUT

Nizam Uddin Siddiqui


(17)
Q14).Write a program to get data Roll No., Name, and
Marks, from the user and write into binary file the program
should be able to get data from user and write onto a
binary file .The program should be able to data from user
and write onto the file as long as user want.

INPUT

OUTPUT

Nizam Uddin Siddiqui


(19)
Q.15). Create a python program implement stack operations.

i
INPUT

Nizam Uddin Siddiqui

(20)
Nizam Uddin Siddiqui

(21)
Nizam Uddin Siddiqui

(22)
Stack Operations:
1. push
2. pop
3. peek
4. Check if Stack is Empty
5. Display Stack
6. Exit
Enter your choice: 3
Top item is 57

stack Operations:
1. push
2. Pop
3. peek
4. Check if stack is Empty
5. Display Stack
6. Exit
E Enter your choice: 4
stack is not empty.

Stack Operations:
1 . push
2 . Pop
3. peek
4 . Check if Stack is Empty
5. Display Stack
6 . Exit
Enter your choice: S
stack elements: ['57']

Nizam Uddin Siddiqui


(23)
Stack Operations:
1 . push
2. Pop
3. peek
4. Check if stack is Bupty
5. Display stack
6 . Exit
Enter your choice: 6
Exiting progran.

Nizam Uddin Siddiqui


(24)

You might also like