How to insert elements into the list at arbitrary positions?

Viewed 5647

I have this

>>> a = [1, 4, 7, 11, 17]

Is there any way to add 4 characters '-' randomly between the other elements to achieve, for example

['-', 1, '-', 4, 7, '-', '-', 11, 17]
4 Answers
Related