medium +22 pts

Prepend a new head

Insert value at the front of the list.

Implement `prepend(values: list, x) -> list` returning a new list with `x` as the new head node.

Constraints

0 ≤ list lengths ≤ 10_000 unless noted.

Example

>>> prepend(...)
# see tests
22 points ~20 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Work on paper with a tiny list first.
Match the function signature exactly.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.