Robotics & Artificial Intelligence
Write Python code to display the following pattern:
1
3 5
5 7 9
7 9 11 13
9 11 13 15 17
Python Control Flow
1 Like
Answer
for i in range(1, 6):
n = 2 * i - 1
for j in range(1, i + 1):
print(n, end=" ")
n = n + 2
print()Output
1
3 5
5 7 9
7 9 11 13
9 11 13 15 17
Answered By
2 Likes
Related Questions
Write Python code to display the following pattern:
1 3 5 7 9 1 3 5 7 1 3 5 1 3 1Write Python code to display the following pattern:
5 5 4 5 4 3 5 4 3 2 5 4 3 2 1Write Python code to display the following pattern:
1 2 3 4 5 2 3 4 5 3 4 5 4 5 5Write Python code to display the following pattern:
9 9 7 9 7 5 9 7 5 3 9 7 5 3 1