benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 73bbb124-a6ca-5406-bd1b-5d8a976dbca8

Problem

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

complete prompt

import re
import string


def task_func(text1, text2):
    """
    This function takes two strings, removes any ASCII punctuation using regular expressions, 
    and returns the cleaned strings as a tuple. It targets punctuation characters defined in 
    `string.punctuation`, which includes the following characters:
    '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'

    Note: This function may not remove non-ASCII or uncommon punctuation symbols.

    Parameters:
    text1, text2 (str): The original texts containing punctuation.

    Returns:
    tuple: A tuple containing the cleaned texts (text1, text2) with punctuation removed.

    Requirements:
    - re
    - string

    Example:
    >>> cleaned_text1, cleaned_text2 = task_func("Hello, world!", "How's it going?")
    >>> print(cleaned_text1, cleaned_text2)
    Hello world Hows it going

    >>> cleaned_text1, cleaned_text2 = task_func("test (with parenthesis []!!)", "And, other; stuff ^_`")
    >>> print(cleaned_text1, cleaned_text2)
    test with parenthesis  And other stuff 
    """

instruct prompt

This function takes two strings, removes any ASCII punctuation using regular expressions, and returns the cleaned strings as a tuple. It targets punctuation characters defined in `string.punctuation`, which includes the following characters: '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' >>> cleaned_text1, cleaned_text2 = task_func("test (with parenthesis []!!)", "And, other; stuff ^_`") >>> print(cleaned_text1, cleaned_text2) test with parenthesis  And other stuff
Note that: This function may not remove non-ASCII or uncommon punctuation symbols.
The function should output with:
    tuple: A tuple containing the cleaned texts (text1, text2) with punctuation removed.
You should write self-contained code starting with:

Code

import re
import string
def task_func(text1, text2):

code prompt

Code

import re
import string
def task_func(text1, text2):

entry point

task_func

libs

  • string
  • re

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