Question #251612

how to print the following half pyramid pattern of numbers

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

Expert's answer

number = 5


for i in range(number):
    for j in range(i+1):
        print(j+1,end=" ")
    print()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS