This repository contains 50 Python-related algorithms and programming problems that are essential for building a strong foundation in Data Science. The exercises cover various topics including basic Python programming, data structures, data manipulation, string manipulation, recursion, data processing, working with DataFrames, data visualization, machine learning, and advanced Python techniques.
- Basic Python Programming
- Data Structures
- Data Manipulation
- String Manipulation
- Recursion and Algorithms
- Data Processing
- Working with DataFrames (Pandas)
- Data Visualization
- Basic Machine Learning
- Advanced Python Techniques
- Calculate the Sum of a List: Write a Python function to calculate the sum of all numbers in a given list.- ✅
- Find the Maximum and Minimum of a List: Write a Python function to find the maximum and minimum elements in a list.- ✅
- Check for Prime Numbers: Write a Python function that checks if a given number is prime.- ✅
- Generate Fibonacci Sequence: Write a Python program to generate the first N numbers of the Fibonacci sequence.- ✅
- Reverse a String: Write a Python function that takes a string and returns it reversed.- ✅
- Implement a Stack Using a List: Create a class that implements the stack data structure using a Python list.- ✅
- Implement a Queue Using a List: Create a class that implements the queue data structure using a Python list.- ✅
- Merge Two Sorted Lists: Write a Python function that merges two sorted lists into a single sorted list.- ✅
- Find Duplicates in a List: Write a Python program to find and print duplicates in a list.- ✅
- Transpose a Matrix: Write a Python function that transposes a given matrix.- ✅
- Remove Duplicates from a List: Write a Python function to remove duplicates from a list while maintaining the original order. ✅
- Flatten a Nested List: Write a Python function to flatten a list of lists (e.g.,
[[1, 2], [3, 4]]
becomes[1, 2, 3, 4]
). ✅ - Filter Even/Odd Numbers from a List: Write a Python function that filters and returns only even or odd numbers from a list.✅
- Group Elements of a List: Write a Python function that groups elements of a list based on a condition (e.g., group by even and odd numbers).✅
- Sort a List of Tuples: Write a Python function to sort a list of tuples based on the second element in each tuple.✅
- Count the Occurrence of Each Character in a String: Write a Python program to count the occurrence of each character in a given string.✅
- Check if a String is a Palindrome: Write a Python function that checks if a given string is a palindrome.✅
- Find All Permutations of a String: Write a Python function to generate all permutations of a given string..✅
- Remove All Punctuation from a String: Write a Python function to remove all punctuation from a given string..✅
- Find the Longest Common Substring: Write a Python program to find the longest common substring in two strings..✅
- Binary Search: Implement the binary search algorithm in Python.✅
- Merge Sort: Implement the merge sort algorithm in Python.✅
- Quick Sort: Implement the quick sort algorithm in Python..✅
- Find the GCD of Two Numbers: Write a Python function that finds the greatest common divisor (GCD) of two numbers using recursion..✅
- Find the N-th Fibonacci Number Using Recursion: Write a Python function to find the N-th Fibonacci number using recursion..✅
- Calculate Moving Averages: Write a Python function to calculate the moving average of a list of numbers.✅
- Find the Median of a List: Write a Python function that finds the median of a list of numbers.✅
- Remove Outliers from a Dataset: Write a Python program to remove outliers from a dataset using the IQR method.✅
- Impute Missing Values in a Dataset: Write a Python function to impute missing values in a dataset using mean, median, or mode.✅
- Normalize a Dataset: Write a Python program to normalize a dataset between 0 and 1.✅
- Load a CSV File into a DataFrame: Write a Python script to load a CSV file into a pandas DataFrame.✅
- Group Data by a Column: Write a Python program to group data in a DataFrame by a specific column.✅
- Filter Data Based on a Condition: Write a Python script to filter rows in a DataFrame based on a condition.✅
- Calculate Summary Statistics: Write a Python program to calculate summary statistics (mean, median, std, etc.) for each column in a DataFrame.✅
- Handle Missing Data in a DataFrame: Write a Python program to handle missing data in a pandas DataFrame.✅
- Plot a Line Chart: Write a Python script to plot a line chart using Matplotlib.✅
- Plot a Histogram: Write a Python program to plot a histogram of a dataset using Matplotlib.✅
- Create a Scatter Plot: Write a Python script to create a scatter plot using Matplotlib.✅
- Plot a Heatmap of Correlation Matrix: Write a Python program to plot a heatmap of a correlation matrix using Seaborn.✅
- Plot Multiple Subplots: Write a Python script to create multiple subplots in a single figure using Matplotlib.✅
- Implement Linear Regression: Write a Python program to implement linear regression using scikit-learn.✅
- Implement Logistic Regression: Write a Python script to implement logistic regression using scikit-learn.✅
- Perform K-Means Clustering: Write a Python program to perform K-Means clustering on a dataset.✅
- Implement a Decision Tree Classifier: Write a Python program to implement a decision tree classifier using scikit-learn.✅
- Implement K-Nearest Neighbors (KNN): Write a Python script to implement the KNN algorithm on a dataset.✅
- Create a Decorator for Function Timing: Write a Python decorator that times the execution of a function and prints the result.✅
- Implement Memoization for Recursive Functions: Write a Python function that uses memoization to optimize a recursive function.✅
- Create a Custom Exception Class: Write a Python class to define a custom exception and use it in a simple program.✅
- Generate and Save Synthetic Data: Write a Python script to generate synthetic data for a dataset and save it to a CSV file.✅
- Parallelize a Task Using Multiprocessing: Write a Python script that uses the multiprocessing library to parallelize a computational task.✅
To solve these problems, you'll need to have Python installed on your machine. You can clone this repository and work on the problems at your own pace. Each problem is designed to reinforce your understanding of Python programming and its applications in Data Science.
If you would like to contribute more problems or solutions, feel free to submit a pull request. Let's make this repository a comprehensive resource for Data Science enthusiasts!
Happy Coding!