Skip to content

Commit 1e58caf

Browse files
committed
Added Number Pyramid script
1 parent 8e909ef commit 1e58caf

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

Number Pyramid Generator/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<div align="center">
2+
3+
# Number Pyramid Generator
4+
5+
</div>
6+
7+
### Description:
8+
This Python script generates a number pyramid based on the user-specified height.
9+
10+
### How to Use:
11+
1. Run the script in a Python environment.
12+
2. Enter the height of the number pyramid when prompted.
13+
3. The script will generate and display the number pyramid.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def generate_number_pyramid(height):
2+
for i in range(1, height + 1):
3+
print(" " * (height - i), end="")
4+
for j in range(1, i * 2):
5+
print(j, end="")
6+
print()
7+
8+
9+
def main():
10+
height = int(input("Enter the height of the number pyramid: "))
11+
generate_number_pyramid(height)
12+
13+
14+
if __name__ == "__main__":
15+
main()

0 commit comments

Comments
 (0)