+ 1
How to obtain this pattern as a output in python
I * *** ***** ******* *********
2 odpowiedzi
+ 1
n = int(input())
n = 3 if n < 3 else n
for i in range(n):
sp = ' '*(n-i)
print(sp + '*'*(2*i+1)+sp)
+ 1
Use loops - for / while.
1 loop to print row elements.
2 loop to print columns.
1st loop inside the 2nd loop.