palle0n
1
project link (https://www.codecademy.com/paths/computer-science/tracks/cspath-python-objects/modules/cspath-python-strings/projects/thread-shed)
Here is the code:
I have a question about steps 8 and 9 of this project
In the code it is from line 120 to line 129 (i commented around that)
It works, but somehow, i dont understand, what is happening in the inner cycle.
Is it replacing string[i] with string[i].strip?
yes, you are updating element in the string
list with the stripped version.
palle0n
3
At first, i thought that i couldn’t do that because it would change the string
Soo, we basically put new element into the place of the old one?
if we look at the documentation:
7.1. string — Common string operations — Python 2.7.18 documentation
wee see strip returns a copy of the string.
Lists on the other hand are mutable, so we do update the list (replacing old by new)
1 Like
palle0n
5
Thank you for clarification! 
system
Closed
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.