r/PythonLearning • • Jun 29 '25

Help Request Helpp

Post image

Help me to solve this pattern guysss 😭

48 Upvotes

28 comments sorted by

View all comments

4

u/program_kid Jun 29 '25

What have you tried so far? What things are you having trouble with?

2

u/[deleted] Jun 29 '25

With spaces and the right aligned triangle.

1

u/program_kid Jun 29 '25

Do you mean you are having trouble understanding the spaces between the numbers and the right triangle?

1

u/[deleted] Jun 29 '25

Yeahh 2nd triangle and Integrating them together

2

u/program_kid Jun 29 '25

I would say look at how the for each row of the right triangle, the number of that row is repeated that same amount (the row with 3 has three 3s, the row with 4 has four 4s) Also notice how the right most number of the left triangle is the number of the row on the right triangle. Lastly, notice how the bottom twice as many numbers as n (for n=5, there are 10 numbers on the last row)

I would suggest using a loop inside of another loop, the outer loop would repeat n times, and the inner loop would create each line

1

u/BranchLatter4294 Jun 29 '25

Why are you having trouble with spaces? How are they any different than any other character?