benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 6d658205-1769-518b-9dba-4dc70d3baefd

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

from random import choice
import turtle
import time

def task_func(colors):
    """
    Draws five squares of random colors using Turtle Graphics. Each square is drawn
    sequentially with a 1-second pause between squares.
    The function requires a list of colors as input and sets up a Turtle Graphics window, 
    creates a Turtle object, and uses it to draw the squares with colors from the provided list.
    The window remains open after drawing.

    Parameters:
        colors (list): A list of color names (as strings) to use for drawing the squares.

    Returns:
        None.

    Requirements:
    - random.choice
    - turtle
    - time

    Examples:
    >>> task_func(['red', 'blue', 'green', 'yellow', 'purple'])  # This will open a Turtle Graphics window and draw squares
    >>> turtle.TurtleScreen._RUNNING
    True  # Check if the Turtle Graphics screen is running
    """

instruct prompt

Draws five squares of random colors using Turtle Graphics. Each square is drawn sequentially with a 1-second pause between squares. The function requires a list of colors as input and sets up a Turtle Graphics window, creates a Turtle object, and uses it to draw the squares with colors from the provided list. The window remains open after drawing.
The function should output with:
    None.
You should write self-contained code starting with:

Code

from random import choice
import turtle
import time
def task_func(colors):

code prompt

Code

from random import choice
import turtle
import time
def task_func(colors):

entry point

task_func

libs

  • turtle
  • random
  • time

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import