Numbers Pattern Programs Using Python

# Pattern for N no.of rows and cols, incrementing by 1 for every column (6,7,8,9.....)

num=int(input("Enter the Number of rws and columns : "))
k=0

for i in range(num): # iterates num times
    k+=i      # incrementing k value with respect to i
m=num+k
for r in range(num):   # iterates for num times
    for col in range(r+1):   
        print(num,end=" ")  #print the value of num with respect to r 
        num+=1       # incrementing num by 1 for every iteration
    print()

# A simple Heart Symbol Program

for i in range(6):
    for j in range(7):
        if (i==0 and j%3!=0) or (i==1 and j%3 == 0 ) or (i-j==2) or(i+j==8):
            print("* ",end="")
        else:
            print(end="  ")
    print()
 
# Right bottom  sided right angle traingle 
#increment number one by one in a row (1, 1 2, 1 2 3, 1 2 3 4,....)

n=int(input(" Enter the Number of rows and columns : "))
for r in range(n):
    for c in range(n-r-1):
        print(" ",end=" ")
    for c in range(r+1):
       print(c+1,end=" ")
    print()
# pyramid pattern , numbers in diagonal lines 

n=int(input("Enter the Number of rows and columns: "))
for r in range(n):
    for c in range(n-r-1):
        print(" ",end=" ")
    for c in range(r,-1,-1):
       print(c+1,end="  ")
       
    print()
 
# Bottom Right right angle traingle 
# one number in a row (1,2 2, 3 3 3, 4 4 4 4,...)

n=int(input("NUMBER : "))
for r in range(n):
    for c in range(n-r-1):
        print(" ",end=" ")
    for c in range(r,-1,-1):
       print(r+1,end=" ")
    print()
# Top left sided right angle traingle
# decrementing columns one by one (1 2 3 4 5 , 1 2 3 4, 1 2 3, 1 2, 1)

n=int(input("Enter the number of rows and columns : "))
for r in range(n):
    for c in range(r,n):
       print(c+1,end=" ")
    print()
# printing square number of rows and columns (5 x 5) of alphabets  from given range

n=int(input("Enter the ASCII value (grater than 64) to start  : "))  #(chr(65) = A)
for i in range(5):
    for j in range(5):
        ch=chr(n)
        print(ch,end='\t')
        n+=1
    print("\n")
# Right angle Triangle numbering rom let to right 

num = int(input("Enter the range : ")) #getting input from user
initial = 1
final = 2
current = final
for i in range(2, num): # ranges from 2 to num - 1 
    for j in range(initial, final):  # ranges from inital and final, value of initial and final will be changed
        current -= 1
        print(current, end=' ')
    print("")
    initial = final  # 1st  final value is 1st value
    final += i  # incrementing final with repect to i 
    current = final  # final is assigned to current value after incrementing 

Join our team, where career growth knows no limits.

For More Details

Our internship program guarantees personalized attention for optimal career development in the tech industry.

+91 97879 68375

-> You should bring your own laptop during the internship

Who can apply?

Internships are open for students who: B.E / B.Tech / M.E / M.Tech / B.Sc / M.Sc / M.C.A / B.C.A / Diploma.

  • Ongoing Students Only
  • days, 5days/ 10days or Based on Student Preference
  • Limited 1 to 10 students per slot
  • Registration fees : 1000 INR
  • Slots are filling quickly only fewer slots are available