-
-
Notifications
You must be signed in to change notification settings - Fork 50.1k
Add pyramid pattern printing program #14314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Please provide descriptive name for the parameter:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added a doctest for the There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Please provide descriptive name for the parameter:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added a doctest for the |
||
| for i in range(n): | ||
| print(" " * (n - i - 1) + "*" * (2 * i + 1)) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| pyramid(5) | ||
There was a problem hiding this comment.
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 functionpyramidPlease provide descriptive name for the parameter:
nThere was a problem hiding this comment.
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
pyramidfunction and renamed the parameter fromntorowsto make it more descriptive. Please review the update. Thank you!