Write a function hide_inside
that consumes a list, an item, and a nonnegative integer pos
.
Your function should produce a new list that contains all the items of the input list with the new item inserted in position pos
. For example,
hide_inside(["a", "b"], "cat", 1]
will produce ["a", "cat", "b"]
. If pos
is greater than the length of the list, the item should appear at the end of the list. For example,
hide_inside(["a", "b"], "cat", 20]
will produce ["a", "b", "cat"]
.
But MODIFIED so that it has a default value such that if no position value is entered it will assume a value of zero. Call you function hide_inside_default.