Explain the difference | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Explain the difference

var word = "SoloLearn" print(word.count) print(word.characters.count)

30th Apr 2019, 5:02 PM
UraL
4 Answers
+ 7
Sorry, it is Swift 4
30th Apr 2019, 5:21 PM
UraL
+ 7
Thanks Lord Krishna for precise answer
30th Apr 2019, 7:22 PM
UraL
+ 4
characters.count is an old deprecated method from v2, v3 count is the current one available from v4 Otherwise, they appear to be the same. The longer one should be used for v2 & v3. Use the shorter one for v4. https://stackoverflow.com/questions/24037711/get-the-length-of-a-string
30th Apr 2019, 6:24 PM
Lord Krishna
Lord Krishna - avatar
+ 3
Is this even python ?
30th Apr 2019, 5:04 PM
Aymane Boukrouh
Aymane Boukrouh - avatar