benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf c3867395-c5ec-5c7e-bba4-1c729452d4b0

Problem

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

complete prompt

import re
import os
import string
import random

def task_func(input_string, directory='./text_files'):
    """
    Split a multi-line string into separate strings, remove special characters, and save each string as a separate text file.
    
    Parameters:
    - input_string (str): The multi-line string to be split and saved.
    - directory (str): The directory where the text files will be saved. Default is './text_files'.
    
    Returns:
    - file_paths (list): A list of file paths where the text is saved.
    
    Requirements:
    - re
    - os
    - string
    - random 
    
    Example:
    >>> task_func('line a\nfollows by line b\n...bye\n')
    ['./text_files/12345.txt', './text_files/67890.txt', './text_files/11223.txt']
    """

instruct prompt

Split a multi-line string into separate strings, remove special characters, and save each string as a separate text file.
The function should output with:
    file_paths (list): A list of file paths where the text is saved.
You should write self-contained code starting with:

Code

import re
import os
import string
import random
def task_func(input_string, directory='./text_files'):

code prompt

Code

import re
import os
import string
import random
def task_func(input_string, directory='./text_files'):

entry point

task_func

libs

  • random
  • string
  • re
  • os

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