benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 3d3ee7e3-9e6a-57ba-8766-c32eda9b7e68

Problem

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

complete prompt

import re
import string

# Constants
PUNCTUATION = string.punctuation

def task_func(text):
    """
    Count the number of words and punctuation marks in a string.

    Parameters:
    - text (str): The input string.

    Returns:
    - tuple: A tuple containing the number of words and punctuation marks.

    Requirements:
    - re
    - string

    Example:
    >>> task_func("Hello, world! This is a test.")
    (6, 3)
    """

instruct prompt

Count the number of words and punctuation marks in a string.
The function should output with:
    tuple: A tuple containing the number of words and punctuation marks.
You should write self-contained code starting with:

Code

import re
import string
# Constants
PUNCTUATION = string.punctuation
def task_func(text):

code prompt

Code

import re
import string
# Constants
PUNCTUATION = string.punctuation
def task_func(text):

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