This repository provides a comprehensive collection of Python functions designed to generate 15 different shapes and patterns, along with unit tests to verify their correctness. It is tailored for beginner and intermediate Python programmers to practice working with functions, loops, conditionals, and unit testing.
- 15 Shape/Pattern Functions: Includes a variety of shapes such as triangles, diamonds, pyramids, and more.
- Detailed Docstrings: Each function is accompanied by a detailed docstring that explains its purpose, parameters, and return values, making it easier to understand and use.
- Complete Unit Test Suite: The
test_shapes.pyfile contains a comprehensive set of unit tests that validate the output of all patterns, ensuring correctness and reliability. - Beginner-Friendly: The code is well-structured and easy to follow, making it suitable for those new to programming.
. ├── shapes.py # Contains placeholder functions with docstrings ├── test_shapes.py # Unit tests for all the shapes and patterns ├── README.md # Documentation for the repository
- Solid Rectangle
- Hollow Rectangle
- Right-angled Triangle
- Inverted Right-angled Triangle
- Pyramid
- Inverted Pyramid
- Diamond
- Hollow Diamond
- Number Triangle
- Floyd's Triangle
- Alphabet Pyramid
- Mirrored Right-angled Triangle
- Hourglass
- Pascal's Triangle
- Diamond Number Pattern
- Python 3.7 or higher is required.
- Install
unittest(pre-installed with Python).
- Open the
shapes.pyfile and implement the placeholder functions. - Each function returns a list of strings, where each string represents a line in the pattern.