Advertisements
Advertisements
प्रश्न
Write a program to print the following pattern:
| 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 |
टीपा लिहा
Advertisements
उत्तर
n = 5
for i in range (n, 0, -1):
# The space will increase on each iteration as i value will decrease
space = (n - i)*" "
print(space, end=" ")
#This for loop will print the increasing numbers
for j in range(1, i + 1):
print(j, end=" ")
print()shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 6: Flow of Control - Exercise [पृष्ठ १४१]
