Triangle Sketcher

View as PDF

Submit solution


Points: 10 (partial)
Time limit: 1.0s
Memory limit: 32M

Author:
Problem type
Allowed languages
Python

An isosceles right triangle is a right triangle that consists of two equal-length legs. Given a number n, we want to sketch an isosceles right triangle with two legs of length n. Specifically, you are required to write a function named trisketch that accepts one integer n as an argument and sketches the triangle with star symbol (*) to the output stream. Note that the right angle of the triangle should be at the bottom-left of your output.

You can start with this template code and ensure your code can run correctly within this template:

def trisketch(n):
    # your code here

# Note that the following code is for local testing purposes only. You should leave this part of code unchanged and not submit it to the OJ system.
T = int(input())
for t in range(T):
    n = int(input())
    trisketch(n)

Please note that you only have to submit the definition of the trisketch function to the OJ system. The rest of the code is for your local testing purposes only.

Input Specification

The first line of the input gives the number of test cases, T, and then T test cases follow.

For each test case, there will be a single line containing an integer that indicates the length of the two equal-length legs of an isosceles right triangle.

Constraints

1 \leq T \leq 100

2 \leq n \leq 100

Output Specification

For each test case, output an isosceles right triangle with two legs of length n using star symbol (*). Ensure that the right angle of the triangle is positioned at the bottom-left of your output.

Sample Input

2
3
5

Sample Output

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

Hint

function for-loop string repetition


Comments

There are no comments at the moment.