benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 7fe3c9b8-2872-5050-aef1-839ce436d7c4

Problem

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

complete prompt

import re
import math

def task_func(s):
    '''
    Count the number of integers and floating-point numbers in a comma-separated string and calculate the sum of their square roots.

    Parameters:
    - s (str): The comma-separated string.

    Returns:
    - count (int): The number of integers and floats in the string.
    - sqrt_sum (float): The sum of the square roots of the integers and floats.
    
    Requirements:
    - re
    - math
    
    Example:
    >>> count, sqrt_sum = task_func('1,2,3.5,abc,4,5.6')
    >>> print(count)  # Ensure this matches exactly with expected output
    5
    >>> print("{:.2f}".format(sqrt_sum))  # Ensure this matches exactly with expected output
    8.65
    '''

instruct prompt

Count the number of integers and floating-point numbers in a comma-separated string and calculate the sum of their square roots.
The function should output with:
    count (int): The number of integers and floats in the string.
    sqrt_sum (float): The sum of the square roots of the integers and floats.
You should write self-contained code starting with:

Code

import re
import math
def task_func(s):

code prompt

Code

import re
import math
def task_func(s):

entry point

task_func

libs

  • math
  • 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