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

PYTHON PROGRAMMING QUESTIONS

Uploaded by

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

PYTHON PROGRAMMING QUESTIONS

Uploaded by

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

PYTHON PROGRAMING QUESTIONS

Basic Python Programming

1. Write a Python program to calculate the factorial of a given number using recursion.

2. Create a program to check if a given string is a palindrome.

3. Write a Python function to find the greatest common divisor (GCD) of two numbers.

4. Implement a program to count the number of vowels in a given string.

5. Write a Python program to generate the Fibonacci series up to n terms.

Lists and Dictionaries

6. Write a Python program to find the largest and smallest numbers in a list.

7. Create a program to count the frequency of each element in a list.

8. Write a Python program to merge two dictionaries and print the resulting dictionary.

9. Implement a Python program to sort a list of tuples based on the second element.

String Manipulation

10. Write a Python program to count the occurrence of each character in a string.

11. Create a Python program to find all the substrings of a given string.

File Handling

12. Write a Python program to read a file and count the number of words, lines, and characters
in it.

13. Implement a Python program to copy the contents of one file to another.

Object-Oriented Programming (OOP)

14. Create a Python class Student with attributes for name, roll number, and marks in three
subjects. Write a method to calculate the average marks of the student.
Advanced Concepts

15. Write a Python program to implement a stack using a list, with operations for push, pop, and
displaying the stack.

16.

17. Write a Python program to create a database named LibraryDB and a table named Books with
columns: BookID (INT, Primary Key), Title (VARCHAR), Author (VARCHAR), and Price (FLOAT).

18. Write a Python program to insert multiple records into the Books table in LibraryDB. Use
placeholders and a list of tuples for the data.
19. Write a Python program to retrieve and display all records from the Books table, ordered by
Price in descending order.

20. Write a Python program to update the Price of a specific book in the Books table based on its
BookID, and display the updated record.

You might also like