Python Practice Problems Roadmap
PYTHON PRACTICE PROBLEMS
1. Beginner Level (Python Basics & Syntax)
1. Write a Python program to print "Hello, World!".
2. Write a program to take two numbers as input and print their sum.
3. Write a program to swap two numbers using a third variable.
4. Write a program to swap two numbers without using a third variable.
5. Write a program to check whether a given number is even or odd.
6. Write a program to find the largest of three numbers.
7. Write a program to check if a number is positive, negative, or zero.
8. Write a program to find the factorial of a number using loops.
9. Write a program to print Fibonacci series up to N terms.
10. Write a program to check whether a number is prime.
2. Conditional Statements & Loops
1. Print numbers from 1 to 100 using loops.
2. Print numbers from 1 to 100 without using loops (recursion).
3. Check if a number is an Armstrong number.
4. Find the GCD and LCM of two numbers.
5. Print the multiplication table of a given number.
6. Count the number of digits in an integer.
7. Reverse a given number.
8. Check if a number is a palindrome.
9. Find the sum of the first N natural numbers.
10. Find the sum of digits of a number.
3. Lists (Arrays in Python)
1. Find the largest and smallest elements in a list.
2. Reverse a list.
3. Remove duplicate elements from a list.
4. Find the second largest and second smallest elements.
5. Find the missing number in a list containing numbers from 1 to N.
6. Sort a list using Bubble Sort.
7. Sort a list using Selection Sort.
8. Sort a list using Insertion Sort.
9. Rotate a list by K positions.
10. Merge two sorted lists.
4. Strings
1. Check if a string is a palindrome.
2. Count the occurrence of each character in a string.
3. Find the first non-repeating character.
4. Reverse a string.
5. Check if two strings are anagrams.
6. Convert uppercase letters to lowercase and vice versa.
7. Find the length of a string without using len().
8. Replace all vowels with *.
9. Check if a string contains only digits.
10. Find the longest word in a sentence.
5. Functions
1. Create a function to calculate factorial.
2. Create a function to check prime numbers.
3. Write a recursive function for Fibonacci.
4. Write a recursive function to calculate power(x, n).
5. Write a function that returns multiple values.
6. Demonstrate *args.
7. Demonstrate **kwargs.
8. Write a function decorator.
9. Implement memoization using decorators.
10. Create a lambda function for common operations.
6. Object-Oriented Programming (OOP)
1. Create a class Car with model and price attributes.
2. Implement constructor (__init__) and instance methods.
3. Create a BankAccount class with deposit and withdrawal methods.
4. Demonstrate inheritance using Animal, Dog, and Cat classes.
5. Demonstrate method overriding.
6. Create an abstract class Shape with subclasses Circle and Rectangle.
7. Demonstrate encapsulation using private variables.
8. Demonstrate polymorphism using multiple classes.
9. Implement a singleton class in Python.
10. Demonstrate class variables vs instance variables.
7. Exception Handling
1. Demonstrate try-except-finally.
2. Handle multiple exceptions.
3. Create and raise a custom exception.
4. Demonstrate the use of raise.
5. Handle IndexError.
6. Handle KeyError.
7. Handle FileNotFoundError.
8. Create custom validation exceptions.
9. Demonstrate nested exception handling.
10. Build a simple calculator with exception handling.
8. Collections & Data Structures
1. Demonstrate Lists, Tuples, Sets, and Dictionaries.
2. Find duplicate elements in a list.
3. Count frequency of elements using a dictionary.
4. Sort a dictionary by values.
5. Use [Link].
6. Use defaultdict.
7. Use deque.
8. Implement a stack using a list.
9. Implement a queue using deque.
10. Implement a priority queue using heapq.
9. File Handling
1. Read a file using open().
2. Write data into a file.
3. Append data to a file.
4. Copy one file to another.
5. Count words in a file.
6. Count lines in a file.
7. Find the most frequent word in a file.
8. Read and write CSV files.
9. Read and write JSON files.
10. Build a simple log analyzer.
10. Modules & Packages
1. Create your own Python module.
2. Import modules using different methods.
3. Use built-in modules like math.
4. Use the random module.
5. Use the datetime module.
6. Create a package with multiple modules.
7. Use os module operations.
8. Use sys module.
9. Explore virtual environments.
10. Publish a simple package structure.
11. Multithreading & Multiprocessing
1. Create a thread using [Link].
2. Run multiple threads simultaneously.
3. Demonstrate thread synchronization using Lock.
4. Create producer-consumer using Queue.
5. Use ThreadPoolExecutor.
6. Demonstrate multiprocessing.
7. Compare threading vs multiprocessing.
8. Use ProcessPoolExecutor.
9. Build a parallel file processor.
10. Implement a concurrent downloader.
12. Database Programming
1. Connect Python to SQLite.
2. Create a database table.
3. Insert records.
4. Update records.
5. Delete records.
6. Execute parameterized queries.
7. Handle database exceptions.
8. Implement transactions.
9. Connect Python to MySQL/PostgreSQL.
10. Build a simple CRUD application.
13. Data Structures & Algorithms
1. Implement Linear Search.
2. Implement Binary Search.
3. Implement Bubble Sort.
4. Implement Selection Sort.
5. Implement Insertion Sort.
6. Implement Merge Sort.
7. Implement Quick Sort.
8. Implement Stack.
9. Implement Queue.
10. Implement Linked List.
11. Implement Binary Search Tree.
12. Implement DFS.
13. Implement BFS.
14. Implement Heap.
15. Solve Two Sum.
16. Solve Valid Parentheses.
17. Solve Maximum Subarray (Kadane's Algorithm).
14. Python for Data Science
1. Create NumPy arrays.
2. Perform matrix operations.
3. Use Pandas DataFrames.
4. Handle missing values.
5. Perform group-by operations.
6. Create visualizations using Matplotlib.
7. Create visualizations using Seaborn.
8. Load datasets.
9. Perform exploratory data analysis (EDA).
10. Build a mini analytics dashboard.
15. Python for AI/ML (Important for You)
1. Implement Linear Regression from scratch.
2. Implement Logistic Regression using Scikit-learn.
3. Train a Decision Tree classifier.
4. Train a Random Forest model.
5. Implement KNN.
6. Perform feature scaling.
7. Evaluate models using accuracy, precision, recall, F1-score.
8. Build a spam classifier.
9. Build a sentiment analysis model.
10. Build a RAG pipeline using LangChain and ChromaDB.
11. Build a chatbot using an LLM API.
12. Build a document Q&A system.
13. Fine-tune a small transformer model.
14. Create a simple AI agent.
15. Build an end-to-end ML project and deploy it with FastAPI.
16. Advanced Python (Interview Level)
1. Lambda expressions.
2. Map, Filter, Reduce.
3. List comprehensions.
4. Dictionary comprehensions.
5. Generators.
6. Iterators.
7. Decorators.
8. Context Managers.
9. Metaclasses.
10. Asyncio.
11. Coroutines.
12. Type Hints.
13. Dataclasses.
14. Memory Management & Garbage Collection.
15. GIL (Global Interpreter Lock).
Placement-Focused Order (for your AI/ML + Backend profile)
1. Python Basics
2. Loops & Functions
3. Lists & Strings
4. OOP
5. Exception Handling
6. Collections
7. File Handling
8. SQL + Databases
9. DSA in Python (50–100 problems)
10. Multithreading
11. FastAPI
12. NumPy + Pandas
13. Scikit-learn
14. PyTorch
15. LangChain + RAG + Agents
This sequence is enough to make you interview-ready for most Python, AI/ML, FastAPI, and
Generative AI internship roles.