Skip to content

Dikeledi-K/Shapes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Python Patterns and Unit Tests

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.

Features

  • 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.py file 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.

Repository Structure

. ├── shapes.py # Contains placeholder functions with docstrings ├── test_shapes.py # Unit tests for all the shapes and patterns ├── README.md # Documentation for the repository

Shapes and Patterns Included

  1. Solid Rectangle
  2. Hollow Rectangle
  3. Right-angled Triangle
  4. Inverted Right-angled Triangle
  5. Pyramid
  6. Inverted Pyramid
  7. Diamond
  8. Hollow Diamond
  9. Number Triangle
  10. Floyd's Triangle
  11. Alphabet Pyramid
  12. Mirrored Right-angled Triangle
  13. Hourglass
  14. Pascal's Triangle
  15. Diamond Number Pattern

How to Use

Prerequisites

  • Python 3.7 or higher is required.
  • Install unittest (pre-installed with Python).

Running the Patterns

  1. Open the shapes.py file and implement the placeholder functions.
  2. Each function returns a list of strings, where each string represents a line in the pattern.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%