File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Patterns/Pyramid_Patterns/Code/Pyramid_Pattern_3 Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ # Pyramid Pattern 3
2+
3+ ** Pattern Image:**
4+
5+ ![ image] ( ../../img/pyramidpattern3.PNG )
6+
7+ ** Contributor:** [ Sanskar Shrivastava] ( https://github.com/SanskarSh )
8+
9+ :star2 : Star it :fork_and_knife : Fork it :handshake : Contribute to it!
10+
11+ Discord server - http://pragmaticprogrammer.in/discord
12+
13+ Happy Coding :purple_heart :
Original file line number Diff line number Diff line change 1+ # Set the number of rows for the pattern
2+ n = 5
3+
4+ # Loop through rows from 1 to 'n'.
5+ for i in range (1 , n + 1 ):
6+
7+ # Loop to print spaces before the numbers in each row.
8+ for k in range (1 , n - i + 1 ):
9+ print (" " , end = " " )
10+
11+ # Loop to print numbers in ascending order in each row.
12+ for j in range (1 , i + 1 ):
13+ print (j , end = " " )
14+
15+ # Move to the next line to start a new row.
16+ print ()
You can’t perform that action at this time.
0 commit comments