Challenge: Right Triangle

right triangle

Question

Print a right triangle with the size specified in the input. See the example below:

Input: 5
Output:
*
**
***
****
*****

Input: 3
Output:
*
**
***


Answer

# the function
def right_triangle(n):
  for i in range(n):
      print('*'*(i+1))

# an example: 
right_triangle(3)


👍 Have fun while coding with Python!

👌 Please Subscribe to receive notifications on future challenges.

💬 If you have any questions simply write a comment down below.

Leave a Comment