Basic usage
Input
append_to(1)
Output
[1]
When called without a list, append_to should create a new list and return [1].
Full lesson preview
Learn how to write functions that use immutable defaults to avoid shared mutable state between calls.
Problem statement
Task
Examples
Input
append_to(1)
Output
[1]
When called without a list, append_to should create a new list and return [1].
Input format
Output format
Constraints
Samples
Input
append_to('a', ['b'])
Output
['b', 'a']
When a list is provided, append the element to it and return the same list.