Control Flow: The for
Loops
Isosceles Triangle
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
It is possible to output an isosceles triangle with the following code:
Code:
def draw_isosceles_triangle(height):
for h in range(height):
for o in range(1, height - h):
print(" ", end='')
for i in range(2*h+1):
print("*", end='')
print()
triangle_height = 10
draw_isosceles_triangle(triangle_height)