benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 9e7fdc6c-341e-54ea-b8ac-14e8c1231372

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 chain

def task_func(L):
    """
    Calculate the mean and variance of all elements in a nested list 'L'.
    
    Parameters:
    - L (list): The nested list.
    
    Returns:
    - dict: A dictionary containing the mean and variance.
    
    Requirements:
    - numpy
    - itertools.chain

    Example:
    >>> task_func([[1,2,3],[4,5,6]])
    {'mean': 3.5, 'variance': 2.9166666666666665}
    """

instruct prompt

Calculate the mean and variance of all elements in a nested list 'L'.
The function should output with:
    dict: A dictionary containing the mean and variance.
You should write self-contained code starting with:

Code

import numpy as np
from itertools import chain
def task_func(L):

code prompt

Code

import numpy as np
from itertools import chain
def task_func(L):

entry point

task_func

libs

  • numpy
  • itertools

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