Python Practice - Pattern Questions
Pyhton Programming - Pattern Printing
In this post we will look into few python programs based on printing various types of patterns.
Write a python program using nested for loops to print the following pattern:
If the input is 5, then the output should be:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Write a python program to print the following pattern:
Try using nested for loops and without nested for loops as well.
If the input is 5, then the output should be:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Write a python program to print the following pattern:
If the input is 4, then the output should be:
1
2 3
4 5 6
7 8 9 10
Write a python program to print the following pattern:
Assume the - to be the space between the numbers.
If the input is 5, then the output should be:
_ _ _ _ 1
_ _ _ 1 2
_ _ 1 2 3
_ 1 2 3 4
1 2 3 4 5
Write a python program using nested for loops to print the following pattern:
If the input is 5, then the output should be:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Write a python program using nested for loops to print the following pattern:
Assume the - to be the space between the numbers.
If the input is 5, then the output should be:
1 2 3 4 5
- 1 2 3 4
- - 1 2 3
- - - 1 2
- - - - 1
Write a python program using nested for loops to print the following pattern:
If the input is 5, then the output should be:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Write a python program using nested for loops to print the following pattern:
Assume the - to be the space between the numbers.
If the input is 4, then the output should be:
- - - 1 - - -
- - 1 2 3 - -
- 1 2 3 4 5 -
1 2 3 4 5 6 7