Skip to main content
Turtle exercise

Flag of France

Sign in to hand in your solution and get feedback.

import turtle as otto width = 240 height = 160 stripe_width = 80 def draw_centered_rectangle(x0, y0, width, height, pencolor, fillcolor): otto.penup() otto.goto(x0 - width / 2, y0 + height / 2) otto.pendown() otto.pencolor(pencolor) otto.fillcolor(fillcolor) otto.begin_fill() for side in range(2): otto.forward(width) otto.right(90) otto.forward(height) otto.right(90) otto.end_fill() # Draw the left, middle, and right stripes with the correct colors. # Add a thin black outline around the flag's outer edge.