for i in range(10):
print('*',end='')
Output
**********
for i in range(5): #change the range stop value for rows
for j in range(10): # change the range stop value for columns
print('*',end='')
print('')
Output
**********
**********
**********
**********
**********
for i in range(1,10):
for j in range(i):
print('*',end='')
#print(j,end='') # to show numbers
print('')
*
**
***
****
*****
******
*******
********
*********
for i in range(10):
for j in range(10-i):
print('*',end='')
#print(j,end='') # to show numbers
print('')
**********
*********
********
*******
******
*****
****
***
**
*
for i in range(1,11):
for k in range(i,10):
print(' ',end='')
for j in range(2*i-1):
print('*',end='')
print('')
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
for i in range(11,0,-1):
for k in range(i,11):
print(' ',end='')
for j in range((2*i)-1):
print('*',end='')
print('')
*********************
*******************
*****************
***************
*************
***********
*********
*******
*****
***
*
for i in range(0,12):
for k in range(i,11):
print('*',end='') # left side
for j in range((2*i)): #
print(' ',end='') # blank between
for k in range(i,11):
print('*',end='') # right side
print('')
**********************
********** **********
********* *********
******** ********
******* *******
****** ******
***** *****
**** ****
*** ***
** **
* *
n = 5
for i in range(n):
print(" " * (n-i-1) + "*" * (2*i+1))
for i in range(n-2, -1, -1):
print(" " * (n-i-1) + "*" * (2*i+1))
*
***
*****
*******
*********
*******
*****
***
*
n = 5
for i in range(n):
for j in range(n):
if i == 0 or i == n-1 or j == 0 or j == n-1:
print('*', end='')
else:
print(' ', end='')
print('')
*****
* *
* *
* *
*****
n = 5
for i in range(n):
print(' ' * i + '*')
for i in range(n-2, -1, -1):
print(' ' * i + '*')
*
*
*
*
*
*
*
*
*
n = 5
for i in range(n):
print(' ' * (n-i-1) + '*' + ' ' * (2*i-1) + ('*' if i > 0 else ''))
for i in range(n-2, -1, -1):
print(' ' * (n-i-1) + '*' + ' ' * (2*i-1) + ('*' if i > 0 else ''))
*
* *
* *
* *
* *
* *
* *
* *
*
n = 5
for i in range(n, 0, -1):
print(' ' * (n-i) + '*' * (2*i-1))
for i in range(2, n+1):
print(' ' * (n-i) + '*' * (2*i-1))
*********
*******
*****
***
*
***
*****
*******
*********
n = 5
num = 1
for i in range(1, n+1):
for j in range(1, i+1):
print(num, end=' ')
num += 1
print('')
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
n = 5
for i in range(1, n+1):
print('*' * i + ' ' * (2*(n-i)) + '*' * i)
for i in range(n, 0, -1):
print('*' * i + ' ' * (2*(n-i)) + '*' * i)
* *
** **
*** ***
**** ****
**********
**********
**** ****
*** ***
** **
* *
n=5
for i in range(n):
num = 1
# Print leading spaces for alignment
print(' ' * (n - i), end='')
for j in range(i + 1):
print(num, end=' ')
num = num * (i - j) // (j + 1)
print()
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
These patterns can be adjusted by modifying the range or loop values.
14-01-2023 | |
12345 1234 123 12 1 |
02-10-2023 | |
12345 1234 123 12 1 |
03-12-2023 | |
12345 1234 123 12 1 |
06-12-2023 | |
1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 |