Question #196875

Print the following pattern using for loops:

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5


Expert's answer

for r in range(2,7):
    line=""
    for c in range(1,r):
        line += str(c)+ " "
    print(line)

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