cant understand different behaviour of the output and what does “list[]” in def(extendList(val, list=[]) means