benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf ac38a8f4-442b-568e-8453-f2868896e0e0

Problem

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

complete prompt

import numpy as np
import random

# Constants
COLORS = ['b', 'g', 'r', 'c', 'm', 'y', 'k']

def task_func(ax):
    """
    Generate a random sine wave function and draw it on a provided matplotlib polar subplot 'ax'. 
    The function randomly selects a color from a predefined list and sets a random position for radial labels.

    Parameters:
    ax (matplotlib.axes._axes.Axes): The ax to plot on.

    Returns:
    str: The color code (as a string) of the plotted function.

    Requirements:
    - numpy
    - random

    Example:
    >>> import matplotlib.pyplot as plt
    >>> random.seed(0)
    >>> fig = plt.figure()
    >>> ax = fig.add_subplot(111, polar=True)
    >>> color = task_func(ax)
    >>> color in COLORS
    True
    >>> plt.close()
    """

instruct prompt

Generate a random sine wave function and draw it on a provided matplotlib polar subplot 'ax'. The function randomly selects a color from a predefined list and sets a random position for radial labels.
The function should output with:
    str: The color code (as a string) of the plotted function.
You should write self-contained code starting with:

Code

import numpy as np
import random
# Constants
COLORS = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
def task_func(ax):

code prompt

Code

import numpy as np
import random
# Constants
COLORS = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
def task_func(ax):

entry point

task_func

libs

  • numpy
  • random

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