Robotics & Artificial Intelligence

Write Python code to display the following pattern:

9
9 7
9 7 5
9 7 5 3
9 7 5 3 1

Python Control Flow

1 Like

Answer

for i in range(1, 6):
    
    for j in range(9, 9 - (2 * i), -2):
        print(j, end=" ")
    
    print()

Output

9 
9 7 
9 7 5 
9 7 5 3 
9 7 5 3 1 

Answered By

3 Likes


Related Questions