Python Starters
Code samples for algorithm, API calls, and data structures written in Python.
Requirementsβ
This project requires minimal setup and you need to have the following installed in your local machine:
Installationβ
Clone Repoβ
git clone https://github.com/mkeithX/python-starters.git
cd python-starters
Setup Virtual Environmentβ
- Windows
 - Unix
 
py -m venv .venv
.venv\Scripts\activate
python3 -m venv .venv
source .venv/bin/activate
Managing Dependenciesβ
- Windows
 - Unix
 
py -m pip install --upgrade pip
py -m pip install --upgrade -r requirements.txt
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade -r requirements.txt
What's insideβ
| Title | Description | 
|---|---|
| Fibonacci Generator | Generates a sequence of numbers where each term is the sum of the two preceding terms. | 
| BMI Calculator | Determines your BMI statusβNormal, Overweight, or Obese. | 
| Cipher/Decipher | Encrypts or decrypts messages using the Caesar Cipher Algorithm. | 
| Password Generator | Generates random passwords with three complexity levels. | 
| Video Downloader | Easily downloads videos. | 
| Countdown Timer | Set and track countdowns. | 
| QR Code Generator | Create QR codes. | 
| Word Guess Game | A fun game for guessing words. | 
| Currency Converter | Convert between currencies. | 
| Weather Forecast | Provides current weather conditions and forecasts. Learn more. | 
Show code sample
import os
class Fibonacci:
    def __init__(self) -> None:
        self.sequence = [0, 1]
    def get(self, index: int):
        """
        Get Fibonacci sequence up to the specified index.
        >>> Fibonacci().get(10)
        [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
        >>> Fibonacci().get(5)
        [0, 1, 1, 2, 3]
        """
        difference = index - len(self.sequence) + 2
        if difference > 0:
            self.sequence.extend(self.sequence[-1] + self.sequence[-2] for _ in range(difference))
        return self.sequence[:index]
def clear_console():
    os.system('cls' if os.name == 'nt' else 'clear')
def main():
    clear_console()
    app_name = "Fibonacci Sequence Generator"
    msg = "(To exit, enter 'exit' or press Ctrl-C)"
    print(f'{"-" * 48}\n{" " * 10}{app_name}\n{" " * 5}{msg}{" " * 12}\n{"-" * 48}')
    fibonacci = Fibonacci()
    while True:
        print()
        prompt = input(">> ").lower()
        if prompt in {"exit", "quit"}:
            break
        try:
            index = int(prompt)
        except ValueError:
            print("Enter a number or 'exit'")
            continue
        print(*fibonacci.get(index), sep=', ')
if __name__ == "__main__":
    main()
Licenseβ
This project is licensed under MIT.
Supportβ
π Give this project a star β on GitHub. π