import turtle # Set up the turtle screen screen = turtle.Screen() screen.title("Turtle House Drawing") pen = turtle.Turtle() # Function to draw a square def draw_square(side_length): for _ in range(4): pen.forward(side_length) pen.right(90) # Function to draw a triangle def draw_triangle(side_length): for _ in range(3): pen.forward(side_length) pen.right(120) # Function to draw a rectangle def draw_rectangle(length, width): for _ in range(2): pen.forward(length) pen.right(90) pen.forward(width) pen.right(90) # Set the starting position for drawing the house pen.penup() pen.goto(-100, -100) pen.pendown() # Draw the base of the house (square) draw_square(200) # Move the pen to draw the roof pen.penup() pen.goto(-100, 100) pen.pendown() # Draw the roof (triangle) draw_triangle(200) # Draw the door (rectangle) pen.penup() pen.goto(-40, -100) pen.pendown() draw_rectangle(80, 100) # Draw the windows (rectangles) pen.penup() pen.goto(-90, 0) pen.pendown() draw_rectangle(40, 60) pen.penup() pen.goto(50, 0) pen.pendown() draw_rectangle(40, 60) # Hide the turtle and display the drawing pen.hideturtle() screen.mainloop()