Question: 1. Write a function called prepend(). Given a list and an element, prepend() returns a new list with the element added to the front of
1. Write a function called prepend().
Given a list and an element, prepend() returns a new list with the element added to the front of the list which was given as an argument.
output = prepend([1, 2], 3) print(output) # -> [3, 1, 2]
2.
Write a function called join_lists().
Given two lists, join_lists returns an list with the elements of "list1" in order, followed by the elements in "list2".
output = join_lists([1, 2], [3, 4]) print(output) # --> [1, 2, 3, 4]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
