0
How is a copied sub-string different from string
i copied a string from 1 var to other but it is not equal... why? https://code.sololearn.com/cnKnz4Y92hjX/?ref=app https://code.sololearn.com/cnKnz4Y92hjX/?ref=app
1 Réponse
- 1
Cause you didn't copied a string. On line 4 you created array (list) of characters. so "Hello"[0] == ["H", "e", "l", "l", "o"][0] (Both are "H"), but the string is not the same as array (list). you may want to try joining list to string:
>> "".join(["H", "e", "l", "l", "o"]) == "Hello"
so line 4 will look like this: cpy="".join([i for i in msg])