gpt-4-0314· openai
from WildChat-4.8M
Write a function called double_lis that accepts one list of numbers as a parameter. The…
Private research annotation
Sign in to add a private research label or note.
- User
Write a function called double_lis that accepts one list of numbers as a parameter. The function should return the list with all elements of the list doubled. It should NOT modify the parameter list.
- Assistant
def double_lis(lis): return [2 * x for x in lis]
Test cases
print(double_lis([1, 2, 3, 4])) # [2, 4, 6, 8] print(double_lis([-1, 0, 1])) # [-2, 0, 2]
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.