Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added patterns/__init__.py
Empty file.
19 changes: 19 additions & 0 deletions patterns/pyramid_pattern.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
Prints a pyramid star pattern.
Example (n = 5):
*
***
*****
*******
*********
"""


def pyramid(n: int) -> None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file patterns/pyramid_pattern.py, please provide doctest for the function pyramid

Please provide descriptive name for the parameter: n

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a doctest for the pyramid function and renamed the parameter from n to rows to make it more descriptive. Please review the update. Thank you!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file patterns/pyramid_pattern.py, please provide doctest for the function pyramid

Please provide descriptive name for the parameter: n

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a doctest for the pyramid function and renamed the parameter from n to rows to make it more descriptive. Please review the update. Thank you!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file patterns/pyramid_pattern.py, please provide doctest for the function pyramid

Please provide descriptive name for the parameter: n

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a doctest for the pyramid function and renamed the parameter from n to rows to make it more descriptive. Please review the update. Thank you!

for i in range(n):
print(" " * (n - i - 1) + "*" * (2 * i + 1))


if __name__ == "__main__":
pyramid(5)
Loading