Write a Python program to print downward triangle mirrored numbers pattern using for loop.
rows = int(input("Enter Downward Triangle Mirrored Numbers Rows = ")) print("====Downward Triangle of Mirrored Numbers Pattern====") for i in range(1, rows + 1): for j in range(i, rows + 1): print(j, end = ' ') for k in range(rows - 1, i - 1, -1): print(k, end = ' ') print()
This Python pattern example prints the downward triangle of mirrored numbers using a while loop.
rows = int(input("Enter Downward Triangle Mirrored Numbers Rows = ")) print("====Downward Triangle of Mirrored Numbers Pattern====") i = 1 while(i <= rows): j = i while(j <= rows): print(j, end = ' ') j = j + 1 k = rows - 1 while(k >= i): print(k, end = ' ') k = k - 1 print() i = i + 1
Enter Downward Triangle Mirrored Numbers Rows = 9
====Downward Triangle of Mirrored Numbers Pattern====
1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1
2 3 4 5 6 7 8 9 8 7 6 5 4 3 2
3 4 5 6 7 8 9 8 7 6 5 4 3
4 5 6 7 8 9 8 7 6 5 4
5 6 7 8 9 8 7 6 5
6 7 8 9 8 7 6
7 8 9 8 7
8 9 8
9