A collection of programs that render geometric shapes in two ways: ASCII art printed to the terminal and graphical plots drawn with matplotlib.
Prints shapes to the console using * characters. Each function takes a parameter n controlling the number of lines:
- Triangle
- Right Triangle
- Square
- Rectangle
- Crown
Draws shapes on a matplotlib coordinate plane with configurable dimensions and positions:
- Rectangle -- defined by width, height, and bottom-left corner
- Circle -- defined by radius and center coordinates
Crown (n=5)
- Python 3
- numpy -- coordinate computation for graphical shapes
- matplotlib -- plotting for advanced shapes
-
Install dependencies:
pip install numpy matplotlib
-
Open either notebook:
jupyter notebook "Shape.ipynb" # ASCII art shapes jupyter notebook "Advanced Shape.ipynb" # Graphical plot shapes
-
Run all cells. For the ASCII shapes, adjust the
nparameter passed to each function to change the size.
GeometricShape/
Shape.ipynb # ASCII art shapes (triangle, square, crown, etc.)
Advanced Shape.ipynb # Matplotlib-drawn rectangle and circle
README.md
images/
Crown.png
