benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 08a653db-0028-5961-9979-35d256a8008e

Problem

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

complete prompt

import struct
import random

# Constants
KEYS = ['470FC614', '4A0FC614', '4B9FC614', '4C8FC614', '4D7FC614']

def task_func(hex_key=None):
    """
    Generate a random float number from a list of hexadecimal strings and then round the float number to 2 decimal places.

    Parameters:
    - None

    Returns:
    - rounded_float (float): The rounded float number.

    Requirements:
    - struct
    - random

    Example:
    >>> random.seed(42)
    >>> print(repr(f"{task_func():.1f}"))
    '36806.1'

    """

instruct prompt

Generate a random float number from a list of hexadecimal strings and then round the float number to 2 decimal places.
The function should output with:
    rounded_float (float): The rounded float number.
You should write self-contained code starting with:

Code

import struct
import random
# Constants
KEYS = ['470FC614', '4A0FC614', '4B9FC614', '4C8FC614', '4D7FC614']
def task_func(hex_key=None):

code prompt

Code

import struct
import random
# Constants
KEYS = ['470FC614', '4A0FC614', '4B9FC614', '4C8FC614', '4D7FC614']
def task_func(hex_key=None):

entry point

task_func

libs

  • struct
  • random

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