|
Small python Program for beginners |
In this article, we are going to print out a horizontal triangle as shown in the featured image using Python.
If you are looking for a Python Tutorial Series then it's here
def pattern(n):
for i in range(1,n+1):
for j in range(1,i+1):
print('*', end='')
print('')
for i in range(n, 1, -1):
for j in range(0, i-1):
print('*', end='')
print('')
pattern(10)
The output of the above code is:
*
**
***
****
*****
******
*******
********
*********
**********
*********
********
*******
******
*****
****
***
**
*
Comments
Post a Comment