Skip to content

Instantly share code, notes, and snippets.

@sayantanHack
Created April 20, 2018 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sayantanHack/ded5ca34e1a4eb6b91c65367d59eebab to your computer and use it in GitHub Desktop.
Save sayantanHack/ded5ca34e1a4eb6b91c65367d59eebab to your computer and use it in GitHub Desktop.
This is a very simple code for paterns of numbers.
'''
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