Answer (Code):
penup()
backward(100)
def bottom_line():
left(120)
color("red")
forward(100)
def triangle():
left(120)
color("blue")
forward(50)
left(120)
color("green")
forward(50)
pendown()
pensize(5)
color("red")
forward(50)
for i in range(4):
triangle()
bottom_line()