Jul-10-2021, 01:14 PM
(Jul-09-2021, 10:52 PM)a04j Wrote: Write a function that returns a new list from the input list with a string xy inserted before the first 0, but only if this 0 is followed by other zeros.The instructions are unclear.
Eg: [3,5,0,0,0,2,5,4,7] then insert string between 5 and 0 [3,5,0,0,2,5,4,6,7] then return the original list.
a) Is the original list ‘input’ by the user or passed as an argument to the function?
b) What is ‘string xy’ and where does it come from?
c) The example has one zero removed and an integer inserted in apparently the wrong place.
d) Should the function return both the new and original list?