Issue 36741: Variable about function and list (original) (raw)
Hello,I'm a Taiwanese student. First,I will say sorry because of my poor English.If I have an offense,please forgive me. Then,look at the picture about program.I declare a list "cards" to the function "Flush",and divide them by 13 in the function.The function Flash will return boolean finally. After that,I write "main" which declare a list and call "Flush" for it to show what value it is.However,when I print this list again,its value will be changed. I'm confused that isn't Flush.cards a local variable belong to Flush? Why Flush can change the list's value for the other function without return? I asked my friend and he was confused,too.So I send this issue and hope to know why it is.Thanks.