benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 34574506-dc53-55cb-8508-87a5b7e31fbe

Problem

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

complete prompt

import csv
import random

# Constants
DATA = ['Temperature', 'Humidity', 'Pressure']
RANGE = {
    'Temperature': (-50, 50),
    'Humidity': (0, 100),
    'Pressure': (980, 1040)
}

def task_func(file_name="data.csv"):
    """
    Generate a CSV file with weather data for each hour of the current day.

    Parameters:
    file_name (str): The path to the CSV file to be created.
    
    Returns:
    str: The path to the created file.

    Note:
    - The row names for the csv are 'Temperature', 'Humidity', and 'Pressure' 
    - Temperature ranged rom -50 to 50
    - Humidity ranged rom 0 to 100
    - Pressure ranged rom 980 to 1040

    Requirements:
    - os
    - datetime
    - csv
    - random

    Example:
    >>> task_func("data.csv")
    'path/to/data.csv'
    """

instruct prompt

Generate a CSV file with weather data for each hour of the current day.
Note that: The row names for the csv are 'Temperature', 'Humidity', and 'Pressure' Temperature ranged rom -50 to 50 Humidity ranged rom 0 to 100 Pressure ranged rom 980 to 1040
The function should output with:
    str: The path to the created file.
You should write self-contained code starting with:

Code

import csv
import random
# Constants
DATA = ['Temperature', 'Humidity', 'Pressure']
RANGE = {
    'Temperature': (-50, 50),
    'Humidity': (0, 100),
    'Pressure': (980, 1040)
}
def task_func(file_name="data.csv"):

code prompt

Code

import csv
import random
# Constants
DATA = ['Temperature', 'Humidity', 'Pressure']
RANGE = {
    'Temperature': (-50, 50),
    'Humidity': (0, 100),
    'Pressure': (980, 1040)
}
def task_func(file_name="data.csv"):

entry point

task_func

libs

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