benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e03aae30-c8f5-5e91-ac86-7495c7481b15

Problem

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

complete prompt

import random
from collections import Counter

# Constants
CARDS = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']

def task_func(x=1):
    """
    Draw x random 5-card poker hands from a 52-card pack (without suits) and return
    the hands along with a counter of the drawn cards.

    Parameters:
    x (int, optional): Number of hands to draw. Default is 1.

    Returns:
    tuple: A tuple containing two elements:
        - list of list str: Each inner list contains 5 strings, representing a 5-card poker hand.
        - Counter: A counter of the drawn cards.


    The output is random; hence, the returned list will vary with each call.

    Requirements:
    - random
    - collections.Counter

    Example:
    >>> random.seed(0)
    >>> result = task_func(1)
    >>> len(result[0][0])
    5
    >>> result[0][0][0] in CARDS
    True
    """

instruct prompt

Draw x random 5-card poker hands from a 52-card pack (without suits) and return the hands along with a counter of the drawn cards. The output is random; hence, the returned list will vary with each call.
The function should output with:
    tuple: A tuple containing two elements:
    list of list str: Each inner list contains 5 strings, representing a 5-card poker hand.
    Counter: A counter of the drawn cards.
You should write self-contained code starting with:

Code

import random
from collections import Counter
# Constants
CARDS = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
def task_func(x=1):

code prompt

Code

import random
from collections import Counter
# Constants
CARDS = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
def task_func(x=1):

entry point

task_func

libs

  • collections
  • random

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