benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 6a07e205-adcd-5a2d-bc0d-cf38487a4a96

Problem

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

complete prompt

import random
import string
import base64
import zlib
def task_func(string_length=100):
    """
    Create a random string of a specified length with uppercase letters and digits, compress it with zlib, 
    and then encode the compressed string in base64.

    Parameters:
    - string_length (int, optional): The length of the random string to be generated. Default is 100.

    Returns:
    str: The compressed string in base64.

    Requirements:
    - base64
    - zlib
    - random
    - string

    Example:
    >>> random.seed(1)
    >>> compressed_string = task_func(50)
    >>> print(compressed_string)
    eJxzNTH0CgqMMHJxMgkwdAyM8rQwc3IMMffzCHDyCAjy9PQI9HY0CY1wtzRx9YmKMg8wjgQAWN0NxA==
    """

instruct prompt

Create a random string of a specified length with uppercase letters and digits, compress it with zlib, and then encode the compressed string in base64.
The function should output with:
    str: The compressed string in base64.
You should write self-contained code starting with:

Code

import random
import string
import base64
import zlib
def task_func(string_length=100):

code prompt

Code

import random
import string
import base64
import zlib
def task_func(string_length=100):

entry point

task_func

libs

  • base64
  • random
  • string
  • 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