Question #241045

Alternate numbers pattern using while loop write a python program how to use the while loop to print the number pattern.

Expert's answer

rows = 10
i = 1
while i <= rows:
    j = 1
    while j <= i:
        print((i * 2 - 1), end=" ")
        j = j + 1
    i = i + 1
    print('')

LATEST TUTORIALS
APPROVED BY CLIENTS