Date: 18 July, 2023
Model: gpt-4
Temperature: 0.2
Passing runs: 10
Total runs: 10
Success rate: 100%
Tokens: 149
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
The above is an incomplete Python code fragment. Return the complete and correct code with no additional text.
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""min_number = min(numbers)
max_number = max(numbers)
return [(x - min_number) / (max_number - min_number) for x in numbers]
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([2.0, 49.9]) == [0.0, 1.0]
assert candidate([100.0, 49.9]) == [1.0, 0.0]
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
assert candidate([2.0, 1.0, 5.0, 3.0, 4.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
assert candidate([12.0, 11.0, 15.0, 13.0, 14.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
Start time: 2023-07-18 18:49:56
Duration: 14.92s
Completion tokens: 161
Result: Pass
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_num = min(numbers)
max_num = max(numbers)
range_num = max_num - min_num
return [(num - min_num) / range_num for num in numbers]
Start time: 2023-07-18 18:49:41
Duration: 14.71s
Completion tokens: 161
Result: Pass
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_num = min(numbers)
max_num = max(numbers)
range_num = max_num - min_num
return [(num - min_num) / range_num for num in numbers]
Start time: 2023-07-18 18:49:28
Duration: 13.33s
Completion tokens: 161
Result: Pass
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_num = min(numbers)
max_num = max(numbers)
range_num = max_num - min_num
return [(num - min_num) / range_num for num in numbers]
Start time: 2023-07-18 18:49:15
Duration: 12.49s
Completion tokens: 161
Result: Pass
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_num = min(numbers)
max_num = max(numbers)
range_num = max_num - min_num
return [(num - min_num) / range_num for num in numbers]
Start time: 2023-07-18 18:49:02
Duration: 13.36s
Completion tokens: 161
Result: Pass
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_num = min(numbers)
max_num = max(numbers)
range_num = max_num - min_num
return [(num - min_num) / range_num for num in numbers]
Start time: 2023-07-18 18:48:48
Duration: 13.34s
Completion tokens: 161
Result: Pass
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_num = min(numbers)
max_num = max(numbers)
range_num = max_num - min_num
return [(num - min_num) / range_num for num in numbers]
Start time: 2023-07-18 18:48:36
Duration: 12.15s
Completion tokens: 161
Result: Pass
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_num = min(numbers)
max_num = max(numbers)
range_num = max_num - min_num
return [(num - min_num) / range_num for num in numbers]
Start time: 2023-07-18 18:48:25
Duration: 11.7s
Completion tokens: 161
Result: Pass
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_num = min(numbers)
max_num = max(numbers)
range_num = max_num - min_num
return [(num - min_num) / range_num for num in numbers]
Start time: 2023-07-18 18:48:09
Duration: 15.01s
Completion tokens: 161
Result: Pass
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_num = min(numbers)
max_num = max(numbers)
range_num = max_num - min_num
return [(num - min_num) / range_num for num in numbers]
Start time: 2023-07-18 18:47:54
Duration: 15.08s
Completion tokens: 161
Result: Pass
from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_num = min(numbers)
max_num = max(numbers)
range_num = max_num - min_num
return [(num - min_num) / range_num for num in numbers]