Python Pattern Questions (50 Questions with Sample Outputs)
Q1. Print right triangle using *
Output (Sample):
*
**
***
****
*****
Q2. Print inverted right triangle using *
Output (Sample):
*****
****
***
**
*
Q3. Print pyramid using *
Output (Sample):
*
***
*****
*******
*********
Q4. Print inverted pyramid using *
Output (Sample):
*********
*******
*****
***
*
Q5. Print square pattern using *
Output (Sample):
*****
*****
*****
*****
*****
Q6. Print hollow square pattern
Output (Sample):
*****
* *
* *
* *
*****
Q7. Print hollow pyramid
Output (Sample):
*
**
* *
* *
*********
Q8. Print diamond pattern
Output (Sample):
*
***
*****
*******
*********
*******
*****
***
*
Q9. Print number triangle
Output (Sample):
1
12
123
1234
12345
Q10. Print repeated number triangle
Output (Sample):
1
22
333
4444
55555
Q11. Print Floyd’s triangle
Output (Sample):
1
23
456
7 8 9 10
Q12. Print alphabet triangle
Output (Sample):
A
AB
ABC
ABCD
ABCDE
Q13. Print same alphabet triangle
Output (Sample):
A
BB
CCC
DDDD
EEEEE
Q14. Print reverse number triangle
Output (Sample):
12345
1234
123
12
1
Q15. Print 0-1 triangle
Output (Sample):
1
01
101
0101
10101
Q16. Print right aligned triangle
Output (Sample):
*
**
***
****
*****
Q17. Print left aligned triangle
Output (Sample):
*
**
***
****
*****
Q18. Print hollow right triangle
Output (Sample):
*
**
**
* *
*****
Q19. Print hollow inverted triangle
Output (Sample):
*****
* *
**
**
*
Q20. Print cross pattern
Output (Sample):
* *
**
*
**
* *
Q21. Print X pattern
Output (Sample):
* *
**
*
**
* *
Q22. Print plus pattern
Output (Sample):
*
*
*****
*
*
Q23. Print border number square
Output (Sample):
11111
12221
12321
12221
11111
Q24. Print concentric square numbers
Output (Sample):
33333
32223
32123
32223
33333
Q25. Print chessboard pattern
Output (Sample):
***
***
***
***
Q26. Print zig-zag pattern
Output (Sample):
* * *
* *
* * *
Q27. Print staircase numbers
Output (Sample):
1
23
456
7 8 9 10
Q28. Print binary pyramid
Output (Sample):
1
10
101
1010
10101
Q29. Print palindromic number pyramid
Output (Sample):
1
121
12321
1234321
123454321
Q30. Print continuous alphabet pattern
Output (Sample):
A
BC
DEF
GHIJ
Q31. Print star border triangle
Output (Sample):
*
**
**
* *
*****
Q32. Print decreasing alphabet pattern
Output (Sample):
EDCBA
EDCB
EDC
ED
E
Q33. Print pattern with @ symbol
Output (Sample):
@
@@
@@@
@@@@
@@@@@
Q34. Print hollow diamond
Output (Sample):
*
**
* *
* *
* *
* *
* *
**
*
Q35. Print butterfly pattern
Output (Sample):
* *
** **
*****
** **
* *
Q36. Print mirrored right triangle
Output (Sample):
*
**
***
****
*****
Q37. Print mirrored number triangle
Output (Sample):
1
12
123
1234
12345
Q38. Print descending numbers
Output (Sample):
54321
5432
543
54
5
Q39. Print alternating 1 and 0 square
Output (Sample):
10101
01010
10101
01010
10101
Q40. Print center aligned stars
Output (Sample):
*
***
*****
***
*
Q41. Print spiral style number box
Output (Sample):
111
121
111
Q42. Print box with diagonals
Output (Sample):
* *
**
*
**
* *
Q43. Print triangle of even numbers
Output (Sample):
2
24
246
2468
Q44. Print triangle of odd numbers
Output (Sample):
1
135
1357
13579
Q45. Print pattern using #
Output (Sample):
#
##
###
####
#####
Q46. Print pattern using numbers in each row
Output (Sample):
1
22
333
4444
Q47. Print alternating alphabet pattern
Output (Sample):
A
BC
DEF
GHIJ
Q48. Print sandglass star pattern
Output (Sample):
*****
***
*
***
*****
Q49. Print wave star pattern
Output (Sample):
* * *
****
* *
Q50. Print triangle using $
Output (Sample):
$
$$
$$$
$$$$
$$$$$