benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 6e172634-a66f-5f16-8599-1842c2e451c2

Problem

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

complete prompt

import re
import hashlib

def task_func(input_str):
    """
    Removes all special characters, punctuation marks, and spaces from the input string using a regular expression,
    retaining only alphanumeric characters. Then hashes the cleaned string with SHA256.

    Parameters:
    input_str (str): The input string to be cleaned and hashed.

    Returns:
    str: The SHA256 hash of the cleaned string.

    Requirements:
    - re
    - hashlib

    Example:
    >>> task_func('Special $#! characters   spaces 888323')
    'af30263c4d44d67917a4f0727191a4149e1ab615b772b2aeda859068178b146c'
    """

instruct prompt

Removes all special characters, punctuation marks, and spaces from the input string using a regular expression, retaining only alphanumeric characters. Then hashes the cleaned string with SHA256.
The function should output with:
    str: The SHA256 hash of the cleaned string.
You should write self-contained code starting with:

Code

import re
import hashlib
def task_func(input_str):

code prompt

Code

import re
import hashlib
def task_func(input_str):

entry point

task_func

libs

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