+ 4
Why this Program take a list argument as call by reference .if i want call by value when function call how can achieve that .
The any change in list inside function affect the list in outside why ? https://code.sololearn.com/cqWbZTtwWLci/?ref=app
2 Antworten
+ 3
You'll have to copy the list yourself. In your function you can do `b = b.copy()`
Python passes everything "by reference" unless it's a primitive type (numbers, strings, booleans). That is to avoid unneccessary copying!
+ 4
This is just an idea:
the argument’s type is a memory adress,
method p change the values contains in this adress, but the argument not change, its the same adress
https://code.sololearn.com/c2l6WHeM6qPJ/?ref=app