benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf de02dbdf-88b9-58ba-ae54-d24bbde045f8

Problem

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

complete prompt

import textwrap
import re

def task_func(input_string, width):
    """
    Divide a multi-line string into separate strings and wrap each line to a certain width.
    
    Parameters:
    - input_string (str): The multi-line string that needs to be wrapped.
    - width (int): The width to wrap each line to.
    
    Returns:
    - str: The wrapped string where each line is wrapped to the specified width.
    
    Requirements:
    - textwrap
    - re
    
    Example:
    >>> task_func('Another line\\nWith wrapping', 8)
    'Another\\nline\\nWith\\nwrapping'
    """

instruct prompt

Divide a multi-line string into separate strings and wrap each line to a certain width.
The function should output with:
    str: The wrapped string where each line is wrapped to the specified width.
You should write self-contained code starting with:

Code

import textwrap
import re
def task_func(input_string, width):

code prompt

Code

import textwrap
import re
def task_func(input_string, width):

entry point

task_func

libs

  • re
  • textwrap

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