benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e6df1053-8922-5713-92ba-ed1fb5a1c1c4

Problem

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

complete prompt

import time
from datetime import datetime
from random import randint
import matplotlib.pyplot as plt


def task_func(duration):
    """
    Generate and draw random data in real time for the specified duration.

    Parameters:
    - duration (int): The duration in seconds for which data is to be generated and plotted.

    Returns:
    - tuple: A tuple containing two lists.
        - The first list contains timestamps (as strings) in the format '%H:%M:%S.%f'.
        - The second list contains the generated random values.

    Requirements:
    - datetime
    - time
    - random
    - matplotlib.pyplot

    Example:
    >>> type(task_func(1))
    <class 'tuple'>
    """

instruct prompt

Generate and draw random data in real time for the specified duration.
The function should output with:
    tuple: A tuple containing two lists.
    The first list contains timestamps (as strings) in the format '%H:%M:%S.%f'.
    The second list contains the generated random values.
You should write self-contained code starting with:

Code

import time
from datetime import datetime
from random import randint
import matplotlib.pyplot as plt
def task_func(duration):

code prompt

Code

import time
from datetime import datetime
from random import randint
import matplotlib.pyplot as plt
def task_func(duration):

entry point

task_func

libs

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