You are giving your function default parameters:
def changeXtransformVal(percentage=1.0, myList = myList):
These are evaluated when the function object is created, but at that time you have no myList
object yet. You don't have to give these parameters default values, and you don't appear to use the values you do give.
If you don't need default values, use:
def changeXtransformVal(percentage, myList):
If you do need a default value for percentage
, move the parameter to the end:
def changeXtransformVal(myList, percentage=1.0):
and adjust your function call accordingly:
changeXtransformVal(myList, percentage=2.0)
Note that you don't have to name parameters either; positional parameters work by position, and in this case percentage=
is optional too.