benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e54a4410-7050-5d93-a962-f57915279e50

Problem

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

complete prompt

import numpy as np
from itertools import product
import string


def task_func(length, seed=None, alphabets=list(string.ascii_lowercase)):
    """
    Generate a list of 10 randomly picked strings from all possible strings of a given
    length from the provided series of characters, using a specific seed for
    reproducibility.

    Parameters:
    length (int): The length of the strings to generate.
    seed (int): The seed for the random number generator. Default is None.
    alphabets (list, optional): The series of characters to generate the strings from. 
                Default is lowercase English alphabets.

    Returns:
    list: A list of generated strings.

    Requirements:
    - numpy
    - itertools.product
    - string

    Example:
    >>> task_func(2, 123)
    ['tq', 'ob', 'os', 'mk', 'du', 'ar', 'wx', 'ec', 'et', 'vx']

    >>> task_func(2, 123, alphabets=['x', 'y', 'z'])
    ['xz', 'xz', 'zx', 'xy', 'yx', 'zx', 'xy', 'xx', 'xy', 'xx']
    """

instruct prompt

Generate a list of 10 randomly picked strings from all possible strings of a given length from the provided series of characters, using a specific seed for reproducibility. >>> task_func(2, 123, alphabets=['x', 'y', 'z']) ['xz', 'xz', 'zx', 'xy', 'yx', 'zx', 'xy', 'xx', 'xy', 'xx']
The function should output with:
    list: A list of generated strings.
You should write self-contained code starting with:

Code

import numpy as np
from itertools import product
import string
def task_func(length, seed=None, alphabets=list(string.ascii_lowercase)):

code prompt

Code

import numpy as np
from itertools import product
import string
def task_func(length, seed=None, alphabets=list(string.ascii_lowercase)):

entry point

task_func

libs

  • numpy
  • itertools
  • string

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