A collection of random Python solutions. If anything helps you here please give this repo a star.
See commentary and other material on the Think Create Repeat YouTube Channel
It's recommended that you use a virtual environment to run each group of scripts. Each folder has its own requirements.txt file. the process for setting up your environment look like
- Move to the topic folder
cd <topic_folder>
- Create a virtual environment
- On Mac:
python3 -m venv .venv
- On Windows:
python -m venv .venv
- On Mac:
- Activate the virtual environment
- On Mac:
source .venv/bin/activate
- On Windows:
.venv\Scripts\activate
- On Mac:
- Install dependencies
- On Mac:
pip3 install -r requirements.txt
- On Windows:
pip install -r requirements.txt
- On Mac:
- Call a specific script
- On Mac:
python3 <script_name>.py
- On Windows:
python <script_name>.py
- On Mac:
- Deactivate virtual environment
deactivate
See this video for additional commentary on Python Dev Environment Setup
- Create a virtual environment
- On Mac:
python3 -m venv .venv
- On Windows:
python -m venv .venv
- On Mac:
- *Activate the virtual environment
- On Mac:
source .venv/bin/activate
- On Windows:
.venv\Scripts\activate
- On Mac:
- Install dependencies
- On Mac:
pip install -r requirements.txt
- On Windows:
pip install -r requirements.txt
- On Mac:
- Run tests
pytest -rA
Here's what you can find here:
- Binary search an efficient search within sorted lists
- Binary search tree a specially organized binary tree that allows divide and conquer searches
- Hamming distance Number of positions in which symbols differ for two equal length strings
- Inorder tree traversal Traverse a binary search tree inorder to list nodes in sorted ascending order
- Merge sort an efficient way to sort a list
- Reverse inorder tree traversal Traverse a binary search tree in reverse inorder to list nodes in sorted descending order
- DynamoDB fully managed NoSQL database service
- Blob storage ubiqutous file storage on Azure
- Key vault secret storage and crypto operations on Azure
- Boards
- 2D grid A simple representation of a 2D grid board that can be used for games like tic-tac-toe or checkers
- Tic-tac-toe board A board based on a 2D Grid that is specialized for the rules of tic-tac-toe
- Cards
- Card deck A collection of cards that can be shuffled and dealt
- Card deck factory A simplified way to construct various types of card decks
- Playing card A representation of a standard playing card
- Clients
- Tic-tac-toe client Play tic-tac-toe using a simple command line client
- Other
- Rubiks Cube Simulator Simulate moves on a 2x2 Rubik's cube
- Fizz buzz A test that makes sure you can apply simple rules and cover all cases
- Largest common prefix Consider what it means to have a common prefix and carfully enumerate the collection and individual characters of each word
- Reverse linked list Reason about interactions with a data structure and carefully manipulate how the data is organized
- Reverse string Understand how to split and join on delimiters
- Swap numbers Write a few cryptic calculations to placate an interviewer trying to trick you
- Two sum Simplify the problem space to find two numbers in a list that add up to a given number
- Valid parens Check for valid brackets sequences by tracking nesting using a stack
- Break even graph Visualize where sales break even with costs
- Multiply matrices Solve a system of linear equations using matrices
- Pie chart Use a math plotting library to create a pie chart and save it to a file
- Plot Vectors Use a math plotting library to plot and annotate vectors
- Extract images from a pdf Use pyMuPDF to extract imges from all pages
- Extract metadata from a pdf Use pyMuPDF to extract metadata from all pages
- Extract pages from a pdf Use pyMuPDF to extract all pages and render the contents as an image
- Extract text from a pdf Use pyMuPDF to extract text from all pages
- Base64 encode and decode A way to represent binary information using plain text
- JSON encode and decode A way to share data structures across languages and systems
- Process command line arguments Parse command line arguments using argparse
- Universally Unique ID A standards based mechanism for generating unique ids
- Working with dates Different ways to work with dates
- Extract frames from a video Use OpenCV to extract frames from a video
- Combine images into a video Use OpenCV to combine images into a video file
- List video properties Use OpenCV to list properties such as frame rate, width, height and total frames
- Flask
- File uploads A reference for uploading a file and saving it to a random name
- HTTP methods A compact reference for using common HTTP methods such as GET, POST, PATCH and DELETE
- SQL database CRUD operations with a database over a REST API
- Django
- Coming soon!
- How do I request a change?
- Please submit an issue or a pull request
- How fast will my request be added?
- Probably not very fast for requests outside of a support package because this repo is maintained by a working professional
- If you require fast, predictable responses, please purchase a support package
- Can support packages be purchased?
- Yes, various support packages can be purchased and customized for your needs. Support areas available include:
- On demand support videos
- 1:1 and team coaching
- New features and other modifications
Licensed under
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)