benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e83d54b8-3d6c-58be-8c43-0476e1d88621

Problem

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

complete prompt

import random
import string

# Constants
LETTERS = string.ascii_letters

def task_func(num_words, word_length):
    """
    Create a list of random words of a certain length.

    Parameters:
    - num_words (int): The number of words to generate.
    - word_length (int): The length of each word.

    Returns:
    - words (list): A list of random words.

    Requirements:
    - random
    - string

    Raises:
    - ValueError: If num_words or word_length is negative.
    
    Example:
    >>> task_func(5, 3)
    ['Ohb', 'Vrp', 'oiV', 'gRV', 'IfL']
    """

instruct prompt

Create a list of random words of a certain length.
The function should raise the exception for: ValueError: If num_words or word_length is negative.
The function should output with:
    words (list): A list of random words.
You should write self-contained code starting with:

Code

import random
import string
# Constants
LETTERS = string.ascii_letters
def task_func(num_words, word_length):

code prompt

Code

import random
import string
# Constants
LETTERS = string.ascii_letters
def task_func(num_words, word_length):

entry point

task_func

libs

  • random
  • 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