377,017 views
41 votes
41 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 Abror Esonaliev
by
2.7k points

1 Answer

14 votes
14 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 CMArg
by
3.1k points