Python Program to Print Solid Right Angled Triangular Pattern

 

Solid Right Angled Triangle

Given an integer number (N) as input. Write a program to print the right-angled triangular pattern of N lines using an asterisk(*) character.

Input

The first line of input will contain a positive integer.

Output

The output should be N lines with an asterisk(*) character printing in a right-angled triangular pattern.

Note: There is a space after each asterisk(*) character.

Explanation

For example, if the given number is 4, the output should be

* 
* * 
* * * 
* * * * 

For example, if the given number is 2,the output should be

* 
* * 

Sample Input 1
6

Sample Output 1

* 
* * 
* * * 
* * * * 
* * * * * 
* * * * * * 

Sample Input 2
3

Sample Output 2

* 
* * 
* * * 

Code:

N=int(input())
i=0
j=1
while i<N:
    print("* "*j)
    j=j+1
    i=i+1

Input
7

Output

* 
* * 
* * * 
* * * * 
* * * * * 
* * * * * * 
* * * * * * *

Comments

Popular posts from this blog

CODING ASSIGNMENT 4

CODING PRACTICE 11 Music Page

CCBP Static Website Coding Assignment 2 Solution | Yoga Page