benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf cbcf512c-148f-57b5-9b5a-a25a2831b421
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import csv
from ipaddress import IPv4Network
def task_func(ip_range, csv_path):
"""
Generates a CSV file listing all IP addresses in the specified IP range.
Each IP address is written as a row in the CSV file.
Requirements:
- csv
- ipaddress.IPv4Network
Parameters:
ip_range (str): The IP range in CIDR notation (e.g., "192.168.0.0/16").
csv_path (str): The path where the CSV file will be saved.
Returns:
str: The path to the generated CSV file.
Examples:
>>> csv_path = task_func('192.168.0.0/16', 'file.csv')
>>> isinstance(csv_path, str)
True
>>> csv_path.endswith('.csv')
True
"""
instruct prompt
Generates a CSV file listing all IP addresses in the specified IP range. Each IP address is written as a row in the CSV file.
The function should output with:
str: The path to the generated CSV file.
You should write self-contained code starting with:
Code
import csv
from ipaddress import IPv4Network
def task_func(ip_range, csv_path):
code prompt
Code
import csv
from ipaddress import IPv4Network
def task_func(ip_range, csv_path):
entry point
task_func
libs
- csv
- ipaddress
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
initial import