benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 8b54c045-b993-5e35-8ec0-69f71592c60d
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import numpy as np
import random
def task_func(my_list):
"""
Appends a randomly selected integer between 0 and 100 to the given list 'my_list' and
returns a numpy array of random floating-point numbers. The size of the returned array
is equal to the sum of the numbers in the modified list.
Parameters:
my_list (list): A list of integers to which a random number will be added.
Returns:
numpy.ndarray: An array of random floating-point numbers. The length of the array
is equal to the sum of the integers in 'my_list' after a random
number has been appended.
Requirements:
- numpy
- random
Examples:
>>> result = task_func([2, 3, 5])
>>> 10 <= len(result) <= 110 # Expecting the length to be within the range after adding a random number between 0 and 100
True
>>> isinstance(result, np.ndarray)
True
"""
instruct prompt
Appends a randomly selected integer between 0 and 100 to the given list 'my_list' and returns a numpy array of random floating-point numbers. The size of the returned array is equal to the sum of the numbers in the modified list.
The function should output with:
numpy.ndarray: An array of random floating-point numbers. The length of the array
is equal to the sum of the integers in 'my_list' after a random
number has been appended.
You should write self-contained code starting with:
Code
import numpy as np
import random
def task_func(my_list):
code prompt
Code
import numpy as np
import random
def task_func(my_list):
entry point
task_func
libs
- numpy
- random
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