Skip to content
Open
Changes from 1 commit
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
18 changes: 18 additions & 0 deletions patterns/pyramid_pattern.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""

Check failure on line 1 in patterns/pyramid_pattern.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (INP001)

patterns/pyramid_pattern.py:1:1: INP001 File `patterns/pyramid_pattern.py` is part of an implicit namespace package. Add an `__init__.py`.
Prints a pyramid star pattern.

Example (n = 5):
*
***
*****
*******
*********
"""

def pyramid(n: int) -> None:
Copy link
Copy Markdown

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
Copy Markdown
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!

Copy link
Copy Markdown

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
Copy Markdown
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!

Copy link
Copy Markdown

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
Copy Markdown
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)

Check failure on line 18 in patterns/pyramid_pattern.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (W292)

patterns/pyramid_pattern.py:18:15: W292 No newline at end of file help: Add trailing newline
Loading