I have created a function that takes a list as a parameter. It shuffles the list, replaces the first element and returns the new list.
import random
firstLi
It does not replace the first list. The first list is passed by reference meaning that any mutations you perform on the list that is passed as the parameter, will also be performed on the list outside of the function, because it is the same list.
However, Strings and other basic types are not passed by reference and therefore any changes you make in your function scope is tot he local copy of the variable only.