1.

Generate the pattern in python programming

Answer»

Answer:

Pattern - 1: NUMBER Pattern

1 rows = int(input("Enter the number of rows: "))

2 # OUTER loop will print number of rows.

3 for i in range(rows+1):

4 # Inner loop will print the value of i after each iteration.

5 for j in range(i):

6 print(i, end=" ") # print number.

7 # line after each ROW to display pattern correctly.

8 print(" ")



Discussion

No Comment Found