Write a Python program to print V numbers pattern using for loop.
rows = int(input("Enter V Number Pattern Rows = ")) print("====The V Numbers Pattern====") for i in range(1, rows + 1): for j in range(1, i + 1): print(j, end = '') for k in range(1, 2 * (rows - i) + 1): print(end = ' ') for l in range(i, 0, -1): print(l, end = '') print()
This Python program prints the alphabetical V pattern of numbers using a while loop.
rows = int(input("Enter Rows = ")) print("========") i = 1 while(i <= rows): j = 1 while(j <= i): print(j, end = '') j = j + 1 k = 1 while(k <= 2 * (rows - i)): print(end = ' ') k = k + 1 l = i while(l >= 1): print(l, end = '') l = l - 1 print() i = i + 1
Enter Rows = 9
========
1 1
12 21
123 321
1234 4321
12345 54321
123456 654321
1234567 7654321
12345678 87654321
123456789987654321