Here’s a comprehensive list of 100 Python questions, covering fundamental to advanced concepts.
These are organized into different levels: Beginner, Intermediate, and Advanced.
Beginner Level (1-30)
1. Hello World Program: Write a Python program to print "Hello, World!".
2. Sum of Two Numbers: Write a function that takes two numbers as input and returns their
sum.
3. Even or Odd Number: Check if a given number is even or odd.
4. Simple Calculator: Write a program to perform addition, subtraction, multiplication, and
division.
5. Area of a Circle: Calculate the area of a circle given its radius.
6. Check Prime Number: Determine if a number is prime.
7. Factorial Calculation: Write a program to find the factorial of a number.
8. Find the Largest Number: Given a list of numbers, find the largest one.
9. Swap Two Variables: Swap the values of two variables without using a temporary variable.
10. Temperature Conversion: Convert a temperature given in Celsius to Fahrenheit.
11. String Reversal: Reverse a given string.
12. Count Vowels in a String: Write a program to count the number of vowels in a given string.
13. Palindrome Checker: Check if a given string is a palindrome.
14. Fibonacci Series: Generate the Fibonacci sequence up to a specified number.
15. Sum of a List: Find the sum of all elements in a list.
16. List Operations:
o Create a list and perform various operations like append, remove, and sort.
17. Remove Duplicates from List: Eliminate duplicate values from a list.
18. Check Armstrong Number: Verify if a number is an Armstrong number.
19. Find the Second Largest Number: Identify the second largest number in a list.
20. Count Words in a String: Count the number of words in a given string.
21. Pattern Printing: Print various patterns using loops.
22. Basic File Handling: Create a file, write text to it, and read it back.
23. Find Average of List Elements: Calculate the average of numbers in a list.
24. Linear Search: Implement linear search to find an element in a list.
25. Binary Search: Write a program to perform binary search on a sorted list.
26. Create a Dictionary: Create a dictionary and perform basic operations like add, delete, and
access.
27. Merge Two Lists: Combine two lists into one.
28. Count Occurrences of an Element: Count how many times an element appears in a list.
29. Generate Random Number: Generate a random number within a specified range.
30. Check Leap Year: Determine if a given year is a leap year.
Intermediate Level (31-70)
31. Find GCD of Two Numbers: Write a program to find the Greatest Common Divisor.
32. Matrix Multiplication: Multiply two matrices.
33. Transpose a Matrix: Find the transpose of a matrix.
34. Bubble Sort: Implement the bubble sort algorithm.
35. Selection Sort: Write a program for selection sort.
36. Insertion Sort: Implement insertion sort.
37. Merge Sort: Write a program for merge sort.
38. Quick Sort: Implement the quick sort algorithm.
39. Palindrome Number: Check if a given number is a palindrome.
40. Power of a Number: Calculate the power of a number using recursion.
41. Luhn Algorithm: Implement the Luhn algorithm to validate a credit card number.
42. Caesar Cipher: Encrypt and decrypt a message using Caesar cipher.
43. Find Common Elements in Two Lists: Identify common elements between two lists.
44. Set Operations: Perform union, intersection, and difference operations on sets.
45. Lambda Functions: Use a lambda function to sort a list of tuples based on the second
element.
46. List Comprehension: Generate a list of squares of numbers from 1 to 10 using list
comprehension.
47. Exception Handling: Demonstrate the use of try, except, else, and finally blocks.
48. Convert String to Datetime: Convert a string representation of date and time into a datetime
object.
49. Class and Object Creation: Create a class named Student with attributes name and age.
50. Object-Oriented Concepts: Implement inheritance, encapsulation, and polymorphism in a
simple program.
51. File Copying: Write a program to copy the contents of one file to another.
52. JSON Parsing: Parse JSON data from a file.
53. Prime Factorization: Find all prime factors of a number.
54. Find Missing Number in a List: Given a list of n-1 numbers ranging from 1 to n, find the
missing number.
55. Linked List Implementation: Implement a singly linked list.
56. Find All Substrings: Find all substrings of a given string.
57. Find the Most Frequent Element: Find the most frequently occurring element in a list.
58. Validate Email Address: Use regular expressions to check if a given email address is valid.
59. Convert Decimal to Binary: Write a program to convert a decimal number to binary.
60. Create a Simple Chatbot: Use basic string matching techniques to create a simple chatbot.
61. Unit Testing: Write unit tests for a function.
62. Database Connection: Connect to a database using Python and perform basic CRUD
operations.
63. Decorator Functions: Create a decorator to log the execution time of a function.
64. Generator Functions: Implement a generator to yield even numbers.
65. Web Scraping: Scrape data from a webpage using requests and BeautifulSoup.
66. Command-Line Arguments: Create a script that accepts command-line arguments.
67. Zip and Unzip Files: Write a program to compress and decompress files using the zipfile
module.
68. Convert a List to a String: Join a list of strings into a single string.
69. Calculate Distance Between Two Points: Write a function to find the distance between two
points in a 2D space.
70. Counting Sort Algorithm: Implement counting sort.
Advanced Level (71-100)
71. Solve the Tower of Hanoi Problem: Write a recursive solution for the Tower of Hanoi.
72. Dijkstra's Algorithm: Implement Dijkstra's algorithm for finding the shortest path in a graph.
73. Multithreading: Create a program that uses multiple threads to perform different tasks.
74. Dynamic Programming - Longest Common Subsequence: Implement a solution for the
Longest Common Subsequence problem.
75. Knapsack Problem: Solve the 0/1 Knapsack problem using dynamic programming.
76. Flask Web Application: Create a simple web application using the Flask framework.
77. REST API Development: Develop a RESTful API using FastAPI.
78. Linear Regression from Scratch: Implement linear regression without using any machine
learning libraries.
79. K-Means Clustering: Implement the K-Means clustering algorithm from scratch.
80. Principal Component Analysis (PCA): Write a program to perform PCA on a dataset.
81. Implement an LRU Cache: Create a Least Recently Used (LRU) cache using Python.
82. Blockchain Implementation: Implement a simple blockchain.
83. Socket Programming: Write a program for a client-server chat application using sockets.
84. Send Emails with Python: Use smtplib to send emails from a Python script.
85. Web Automation: Automate web browsing tasks using Selenium.
86. Data Encryption and Decryption: Use Python's cryptography library to encrypt and decrypt
data.
87. Graph Traversal - DFS and BFS: Implement Depth-First Search (DFS) and Breadth-First Search
(BFS) algorithms.
88. Speech Recognition: Convert speech to text using Python's speech_recognition library.
89. Create a Sudoku Solver: Write a program to solve a given Sudoku puzzle.
90. Natural Language Processing (NLP): Perform basic NLP tasks like tokenization and stemming
using nltk.
91. Text-to-Speech Conversion: Convert text to speech using the pyttsx3 library.
92. Automate Excel Tasks: Use openpyxl to read and write data to Excel sheets.
93. Image Processing: Perform image processing tasks using Pillow and OpenCV.
94. TensorFlow Basics: Create a simple neural network using TensorFlow.
95. Use Git in Python: Automate Git operations using Python.
96. Create a ChatGPT-like Bot: Implement a chatbot using the transformers library.
97. Scrape a Dynamic Website: Scrape content from a website that uses JavaScript.
98. Build a Recommendation System: Create a basic recommendation system using
collaborative filtering.
99. Blockchain Smart Contract Simulation: Simulate smart contracts using Python.
100. Face Detection: Detect faces in an image using OpenCV's Haar Cascades.