|
1 | | -<!--hide--> |
2 | | -# Algorithm optimization in Python - Step by step guide |
3 | | -<!--endhide--> |
| 1 | +# Algorithm Optimization Project |
4 | 2 |
|
5 | | -- Optimize Python code. |
| 3 | + |
6 | 4 |
|
7 | | -## 🌱 How to start this project |
| 5 | +This repository contains exercises designed to help you practice optimizing Python algorithms for better performance and readability. |
8 | 6 |
|
9 | | -Follow the instructions below: |
| 7 | +## 📚 What You'll Learn |
10 | 8 |
|
11 | | -1. Create a new repository by forking the [Git project](https://github.com/4GeeksAcademy/algorithm-optimization-project-machine-learning) or [by clicking here](https://github.com/4GeeksAcademy/algorithm-optimization-project-machine-learning/fork). |
12 | | -2. Open the newly created repository in Codespace using the [Codespace button extension](https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository). |
13 | | -3. Once the Codespace VSCode has finished opening, start your project by following the instructions below. |
| 9 | +- Text processing optimization techniques |
| 10 | +- Efficient list operations and filtering |
| 11 | +- Using Python's built-in functions and data structures |
| 12 | +- Code modularity and best practices |
| 13 | +- Performance analysis and improvement strategies |
14 | 14 |
|
15 | | -## 📝 Instructions |
| 15 | +## 🎯 Assignment Overview |
16 | 16 |
|
17 | | -1. Once you start working on the project, you will see a `./notebook/problems.ipynb` file containing a list of exercises. |
| 17 | +The `problems.ipynb` notebook contains two main exercises: |
18 | 18 |
|
19 | | -2. Before starting, make sure to select the **appropriate Kernel**. |
| 19 | +1. **Text Processing Optimization** - Improve code that processes text by converting to lowercase, removing punctuation, counting word frequencies, and finding the most common words. |
20 | 20 |
|
21 | | - - When you open the notebook, a message will appear at the top indicating **"Select Kernel"**. |
22 | | - - Click on **"Select Kernel"** (as shown in the image). |
| 21 | +2. **List Processing Optimization** - Enhance code that filters even numbers, duplicates values, sums results, and checks for prime numbers. |
23 | 22 |
|
24 | | - |
| 23 | +Each exercise includes working but inefficient code that you'll optimize using better algorithms, data structures, and Python idioms. |
25 | 24 |
|
26 | | -3. A list with available options will be displayed. Select **"Python Environments"** and choose the Python version you want to use. |
| 25 | +## 🚀 Getting Started |
27 | 26 |
|
28 | | - - Make sure to select the version specified in the `devcontainer.json` file, as this is the recommended one for the project. |
| 27 | +### Option 1: GitHub Codespaces (Recommended) |
| 28 | +1. Fork this repository to your GitHub account |
| 29 | +2. Click the green "Code" button on your forked repository |
| 30 | +3. Select "Codespaces" tab |
| 31 | +4. Click "Create codespace on main" |
| 32 | +5. Wait for the environment to load (this may take a few minutes) |
| 33 | +6. Open `problems.ipynb` and start working! |
29 | 34 |
|
30 | | - |
| 35 | +### Option 2: Local Development |
| 36 | +1. Fork and clone this repository |
| 37 | +2. Create a virtual environment: `python -m venv venv` |
| 38 | +3. Activate the virtual environment: |
| 39 | + - On Windows: `venv\Scripts\activate` |
| 40 | + - On macOS/Linux: `source venv/bin/activate` |
| 41 | +4. Install Jupyter: `pip install jupyter` |
| 42 | +5. Install dependencies: `pip install -r requirements.txt` |
| 43 | +6. Launch Jupyter: `jupyter notebook` |
| 44 | +7. Open `problems.ipynb` |
31 | 45 |
|
32 | | -> Note: We also incorporated a `./notebook/solutions.ipynb` file that we strongly suggest you only use if you are stuck for more than 30 min or if you have already finished and want to compare it with your approach. |
| 46 | +## 📝 Working with the Notebook |
33 | 47 |
|
34 | | -## 🚛 How to deliver this project |
| 48 | +- Each exercise contains the original inefficient code followed by optimization points |
| 49 | +- Review the provided solutions as reference implementations |
| 50 | +- Try implementing your own optimizations before checking the solutions |
| 51 | +- Run each cell to test your code and compare performance |
35 | 52 |
|
36 | | -Once you have finished solving the exercises, be sure to commit your changes, `push` to your repository and go to 4Geeks.com to upload the repository link. |
| 53 | +## 🎓 Learning Goals |
37 | 54 |
|
| 55 | +By completing this assignment, you will: |
| 56 | +- Understand common performance bottlenecks in Python code |
| 57 | +- Learn to use appropriate data structures for different problems |
| 58 | +- Practice writing clean, modular, and efficient code |
| 59 | +- Gain experience with Python's built-in optimization tools |
| 60 | + |
| 61 | +## 📊 Assessment |
| 62 | + |
| 63 | +Focus on: |
| 64 | +- **Correctness**: Does your optimized code produce the same results? |
| 65 | +- **Efficiency**: Is your solution faster and more memory-efficient? |
| 66 | +- **Readability**: Is your code clean and well-structured? |
| 67 | +- **Best Practices**: Are you using appropriate Python idioms? |
| 68 | + |
| 69 | +Happy coding! 🐍✨ |
0 commit comments