+ 2
What is happening?
Can you explain me what is happening in this codes?
6 Antworten
+ 5
1. Sololearn playground
2. "\" is used to escape character sequences. "\\" should escape the "\". As neither "\s" nor "\spec" is an escape sequence in Python, "\" can safely be interpreted as "\" which may be why the interpreter accepts it without error.
3. text_pro=text does not copy the list. "text_pro" is only a reference to the same list that is stored in "text", hence you are appending to the same list tha tyou are iterating.
+ 3
This reading will help you understand better the third problem.
https://inventwithpython.com/beyond/chapter8.html#calibre_link-172
In short, it is bad to modify an iterable while you are looping at it.
0
Here my code update 🗿. Upvote ✨
https://sololearn.com/compiler-playground/cPn2D3N214G0/?ref=app
0
Lisa I didn't understand first one.
0
I don't remember the exact explanation of the first one, but it is specific to how sololearn playground handles the code. I'll update you in case I find that discussion again...
It happens for code bits in the other programming languages as well.