benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf ff0b2048-cd6e-5a7c-bc61-f0fb4b5c3c34

Problem

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

complete prompt

import struct
import zlib

# Constants
KEY = '470FC614'

def task_func(hex_string=KEY):
    """
    Converts a given hex string to a float number and then compresses the binary32 float number.

    Parameters:
    hex_string (str, optional): The hex string to be converted. Defaults to 470FC614.

    Returns:
    bytes: The compressed float number.

    Requirements:
    - struct
    - zlib

    Example:
    >>> task_func("470FC614")
    b'x\\x9c\\xf3\\xeb\\x93\\xef\\x01\\x00\\x03\\xb0\\x01\\x88'
    >>> task_func("ABCD1234")
    b'x\\x9c\\xf3\\xd7>+\\x04\\x00\\x03m\\x01Z'
    """

instruct prompt

Converts a given hex string to a float number and then compresses the binary32 float number.
The function should output with:
    bytes: The compressed float number.
You should write self-contained code starting with:

Code

import struct
import zlib
# Constants
KEY = '470FC614'
def task_func(hex_string=KEY):

code prompt

Code

import struct
import zlib
# Constants
KEY = '470FC614'
def task_func(hex_string=KEY):

entry point

task_func

libs

  • struct
  • zlib

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