benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 127c48e0-b2ed-509d-bed8-6e19053fa116

Problem

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

complete prompt

import numpy as np
import math

# Constants
POSSIBLE_NUMBERS = np.arange(1, 11)

def task_func(list_of_lists):
    """
    Calculate the sum of the squares of numbers from a predefined range (POSSIBLE_NUMBERS) 
    for each list in list_of_lists. The number of elements considered from POSSIBLE_NUMBERS 
    is determined by the length of each list.

    Parameters:
    - list_of_lists (list): A list of lists, each representing a set of numbers.

    Returns:
    - sums (list): A list of sums of squares.

    Requirements:
    - numpy
    - math

    Example:
    >>> sums = task_func([[1, 2, 3], [4, 5]])
    >>> print(sums)
    [14.0, 5.0]
    """

instruct prompt

Calculate the sum of the squares of numbers from a predefined range (POSSIBLE_NUMBERS) for each list in list_of_lists. The number of elements considered from POSSIBLE_NUMBERS is determined by the length of each list.
The function should output with:
    sums (list): A list of sums of squares.
You should write self-contained code starting with:

Code

import numpy as np
import math
# Constants
POSSIBLE_NUMBERS = np.arange(1, 11)
def task_func(list_of_lists):

code prompt

Code

import numpy as np
import math
# Constants
POSSIBLE_NUMBERS = np.arange(1, 11)
def task_func(list_of_lists):

entry point

task_func

libs

  • math
  • numpy

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