Created
April 20, 2018 20:39
-
-
Save sayantanHack/ded5ca34e1a4eb6b91c65367d59eebab to your computer and use it in GitHub Desktop.
This is a very simple code for paterns of numbers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
code forthe patern bellow : | |
1 | |
12 | |
123 | |
1234 | |
12345 | |
''' | |
n = input("Enter the num : ") | |
for i in range(1,n+1): | |
for j in range(1,i+1): | |
print(j,end='') # end is for not going to new line | |
print() # blank print is for new line | |
''' | |
code for paterns bellow : | |
54321 | |
4321 | |
321 | |
21 | |
1 | |
''' | |
for i in range(n-1,0,-1 ): | |
for j in range(i+1,1,-1): | |
print(j,end='') | |
print() | |
''' | |
for this patern bellow: | |
1234 | |
123 | |
12 | |
1 | |
''' | |
for i in range(n,0,-1): | |
for j in range(1,i+1): | |
print(j,end='') | |
print() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment