#
Question Text#
Create a function named {{ params_vars_amount }}_index
that has two parameters named numbers
and index
.
The function should return a new list where all elements are the same as in numbers
except for the element at index
, which should be double its original value.
If index
is not a valid index, the function should just return the original list. Negative indexes that are valid should work as well.
You do not need to validate the type and contents of the input list numbers
, its guaranteed to be a list, and of types that support multiplication with integers, such as but not limited to int
and float
, but the length of the list is not guaranteed, and empty lists are valid inputs. Furthermore, index
is guaranteed to be an integer, but the size and sign are not guaranteed.
Some example outputs to help you understand the problem:
{{ params_vars_amount }}_index({{ params_examples_numbers1 }}, {{ params_examples_index1 }}) == {{ params_examples_output1 }}
{{ params_vars_amount }}_index({{ params_examples_numbers2 }}, {{ params_examples_index2 }}) == {{ params_examples_output2 }}
Answer Section#
pl-submission-panel#
Attribution#
Problem is licensed under the CC-BY-NC-SA 4.0 license.