Append an integer
Input
append_value([1, 2], 3)
Output
[1, 2, 3]
The function appends 3 to the provided list and returns the list with the new element.
Full lesson preview
Practice modifying a list passed into a function (in-place) and returning the updated list.
Problem statement
Task
Examples
Input
append_value([1, 2], 3)
Output
[1, 2, 3]
The function appends 3 to the provided list and returns the list with the new element.
Input format
Output format
Constraints
Samples
Input
append_value(['a'], 'b')
Output
['a', 'b']
The value 'b' is appended to the existing list.