Python Program for Printing Basic Double Incrementing Triangle Pattern

Printing Basic Double Incrementing Triangle Pattern

Patterns are one of the best ways to understand a logic building or develop our skills in problem-solving. Pattern printing is done using for and while loops. In this python program, we will use for loop to print the pattern according to user inputs. User inputs will be the number of rows and columns that will define the start and end of the pattern.

Algorithm for Printing Basic Double Incrementing Triangle Pattern

Algorithm

  • Step 1:- Start.
  • Step 2:- Take user input.
  • Step 3:- Initialize a count variable.
  • Step 4:- Start a for loop as a driver loop.
  • Step 5:- Start a loop in range to iterator of 1st loop.
  • Step 6:- Print count variable with end = ” ” to continue printing in same line.
  • Step 7:- Use a print function to break the line.
  • Step 8:- End.
Python Program for Printing Basic Double Incrementing Triangle Pattern

Python program to print double incrementing triangle pattern

#take inputs
Row = int(input('Enter the number of rows :'))
Count = 1
#using for loop 
for i in range(Row+1):
    #lop for printing Count
    for j in range(i):
        #print values
        print(Count,end = ' ')
        #increment values
        Count+=1
    #break the line
    print('')
Output:
Enter the number of rows :5


2 3
4 5 6
7 8 9 10
11 12 13 14 15