benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 7dbbba4a-4324-52e7-9642-cf66daa470aa

Problem

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

complete prompt

import time
import numpy as np


def task_func(samples=10, delay=0.1):
    """
    Make a delay for a given amount of time for a specified number of samples,
    measure the actual delay and calculate the statistical properties of the
    delay times.

    Parameters:
    - samples (int): Number of samples for which the delay is measured.
                     Default is 10.
    - delay (float): Amount of time (in seconds) for each delay.
                     Default is 0.1 second.

    Returns:
    tuple: The mean and standard deviation of the delay times.

    Requirements:
    - time
    - numpy

    Example:
    >>> mean, std = task_func(samples=5, delay=0.05)
    >>> print(f'Mean: %.3f, Std: %.1f' % (mean, std))
    Mean: 0.050, Std: 0.0
    >>> mean, std = task_func(100, 0.001)
    >>> print(f'Mean: %.3f, Std: %.4f' % (mean, std))
    Mean: 0.001, Std: 0.0000
    """

instruct prompt

Make a delay for a given amount of time for a specified number of samples, measure the actual delay and calculate the statistical properties of the delay times.
The function should output with:
    tuple: The mean and standard deviation of the delay times.
You should write self-contained code starting with:

Code

import time
import numpy as np
def task_func(samples=10, delay=0.1):

code prompt

Code

import time
import numpy as np
def task_func(samples=10, delay=0.1):

entry point

task_func

libs

  • numpy
  • time

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