Skip to content

Commit

Permalink
Create hourglass_pattern.py
Browse files Browse the repository at this point in the history
Added a python file that demonstrates how to print an hourglass pattern using *
  • Loading branch information
SanBuilds committed Oct 3, 2022
1 parent ca814e2 commit 67505a6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Python/hourglass_pattern.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
### Github Username - SanBuilds (https://github.com/SanBuilds)
### Hourglass pattern in python

rows = int(input("Enter the rows(height) of the hourglass: "))

for i in range(rows):
for j in range(i):
print('', end = ' ')
for k in range(i,rows):
print('*', end = ' ')
print()

for i in range(rows,-1,-1):
for j in range(i):
print('', end = ' ')
for k in range(i,rows):
print('*', end = ' ')
print()

0 comments on commit 67505a6

Please sign in to comment.