0% found this document useful (0 votes)
34 views19 pages

Csproj

This document contains 24 questions about writing Python programs related to various tasks like arithmetic operations, checking if a number is prime, implementing stacks, working with files and databases. The questions cover a wide range of Python programming concepts and tasks.

Uploaded by

arqam Saad
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)
34 views19 pages

Csproj

This document contains 24 questions about writing Python programs related to various tasks like arithmetic operations, checking if a number is prime, implementing stacks, working with files and databases. The questions cover a wide range of Python programming concepts and tasks.

Uploaded by

arqam Saad
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/ 19

Index

S.N NAME OF DAT PAGE Sign of Teacher


O PRACTICAL E NO
1. Write a program to enter two numbers and print the
arithmetic operations like +,-,*,/,// and % as per user choice.
Ans:-

2. Write a program to check entered number is Armstrong or


not.
Ans:
3. Write a program to enter the number of terms and to print
the Fibonacci series.

Ans:

4. Write a program to enter the string and display the longest


word present in the entered string.

Ans:
5. Write a python function that takes a number as a parameter and
checks whether a number is prime or not.

Ans:

6. Write a python function to add the first ‘n’ terms of the


series:
1+1/2-1/3+1/4-1/5+………………………

Ans:
7. Write a program that accepts a hyphen-separated sequence of
words as input and print the words in a hyphen-separated
sequence after storing them alphabetically.

Ans:

8. Write a python function to calculate the factorial of a number (a


non-negative integer). The function accepts the number whose
factorial is to be calculated as the argument.

Ans:
9.Write a program to remove all the lines that contain the
character “b” in a file and write it into another text file.

Ans:
10. Write a program to read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in the file.
11. Write a program to create a binary file with name and roll no.
Search for a given roll number and display the name, if not found
display appropriate message.
12. Write a program to create a binary file to store Rollno, Name
and Marks and update marks of entered Rollno.
13. Write a program to implement a stack using a list data
structure.
14. Write a program to read a text file line by line and display
each word separated by #.

15. Write a program to accept string/sentences from the user till


the user enters “END”. Save the data in a text file and then
display only those sentences which begin with an uppercase
alphabet.
16. Write a program to read a file ‘Story.txt’ and create another
file, storing an index of ‘Story.txt’, telling which line of the file
each words appears in. If word appears more than once, then
index should show all the line numbers containing the word.

17. Write a program to display the size of the file after removing
EOL characters, leading and trailing white spaces and blank lines.
18. Raj has been asked to display all the students who have
secured less than 40 for Remedial Classes. Write a user-defined
function to display those students who have secured less than 40
from the binary file “Student.dat”.
19. Write a program to create CSV file and store empno, name,
salary and search any empno and display name, salary and if not
found appropriate message
20.Write a menu driven program to implement Stack in Python
using List.
21. Write a program to connect with database and store record of
employee and display records.
22. Write a program to connect with database and search
employee number in table employee and display record, if empno
not found display appropriate message.
Write a program to connect with database and update the
employee record of entered empno.
24. Write a program to connect with database and delete the
record of entered employee number

You might also like