Robotics & Artificial Intelligence

Write Python code to display the following pattern:

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

Python Control Flow

2 Likes

Answer

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

Output

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

Answered By

3 Likes


Related Questions