For more color choices: https://en.wikipedia.org/wiki/Web_colors#X11_color_names

stage.set_background("grid") """ Define variables for x, y, side length, and color. Using those variables draw a square centered at x and y, with given side length and color. Using the appropriate variables, calculate the area of the square and display it below the square. """ sq_x = 150 sq_y = 200 sq_side = 50 sq_color = "red" # sprite = codesters.Square(x, y, width, "color") square = codesters.Square(sq_x, sq_y, sq_side, sq_color) sq_area = sq_side ** 2 # text = codesters.Text("text", x, y) sq_area_txt = codesters.Text(str(sq_area), sq_x, sq_y-sq_side/2 - 10) """ Define variables for x, y, radius, and color; draw a circle centered at x and y, with a diameter based on the given radius. Using the appropriate variables, calculate the area of the circle and display it above the circle. """ PI = 3.14 # sprite = codesters.Circle(x, y, diameter, "color") """ Given an x, y, width, height, and color; draw a rectangle centered at x and y, with the given length, width, and color. Using the appropriate variables, calculate the area of the rectangle and display it above the rectangle """ # sprite = codesters.Rectangle(x, y, width, height, "color") """ Given an x, y, side length, and color; draw a triangle centered at x and y, with the given side lengths and color. Using the appropriate variables, calculate the area of the triangle and display it above the triangle """ # sprite = codesters.Triangle(x, y, size, "color")
  • Run Code
  • Show Console
  • Codesters How To (opens in a new tab)