Python program to print Triangular Patterns

Print the following patterns for a given N number of rows.

Pattern - 1


Note: There are no spaces.  
For N = 4
*
**
***
****
Input format :
Integer N (Total no. of rows)
Output format :
The pattern in N lines
Sample Input:
5
Sample Output:
*
**
***
****
***** 



Pattern - 2

For N = 5
1
22
333
4444
55555
Input format :
Integer N (Total no. of rows)
Output format :
The pattern in N lines
Sample Input:
6
Sample Output:
1
22
333
4444
55555
666666


Pattern - 3

For N = 4
1
21
321
4321
Input format :
Integer N (Total no. of rows)
Output format :
A pattern in N lines
Sample Input :
6
Sample Output :
1
21
321
4321
54321
654321


Pattern - 4


For N = 4
1
11
202
3003
40004
Input format :
Integer N (Total no. of rows)
Output format :
The pattern in N lines
Sample Input:
4
Sample Output:
1
11
202
3003

Pattern - 5

For N = 3
1
11
121
Input format :
Integer N (Total no. of rows)
Output format :
The pattern in N lines
Sample Input:
4
Sample Output:
1
11
121
1221

Pattern - 6

For N = 4
1234
123
12
1
Input format :
Integer N (Total no. of rows)
Output format :
A pattern in N lines
Sample Input :
5
Sample Output :
12345
1234
123
12
1

Pattern - 7

For N = 3
A
BB
CCC
Input format :
Integer N (Total no. of rows)
Output format :
A pattern in N lines
Sample Input :
7
Sample Output :
A
BB
CCC
DDDD
EEEEE
FFFFFF
GGGGGGG

Pattern - 8

Note: each line consists of an equal number of characters + spaces. Suppose you are printing the xth line for N=n. You need to print 1..x followed by (n-x) spaces, again (n-x) spaces followed by x..1

For N = 5
1 1
12 21
123 321
1234 4321
1234554321

Sample Input :

4
Sample Output :
1 1
12 21
123 321
12344321

Previous Post Next Post