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