164k views
4 votes
Find out how to print the below pattern in python and also come up with pseudocode,

you have to use for loop for this, you can use a for loop inside the outer for loop.
You can't use operator like " *" in python , only use print statement to print the below pattern. Find out how to print in 5 lines one by one in python , there is a way to print one line then next
X

XXX

XXXXX

XXXXXXX

XXXXXXXXX

User MewX
by
3.5k points

1 Answer

2 votes

Answer:

for i in range(5):

for j in range(2*i + 1):

print("*", end="")

print()

Step-by-step explanation:

for row index going from 0 to 5
for column index going from 0 to 2*row index + 1
print * suppressing new line

print a new line to move to next row

User Gnomed
by
4.8k points