+ 2

'count' method for a string

Why 'count' method with argument('') aplied for a string returns value greater than real value? https://code.sololearn.com/cFN3LRo4eZ16/?ref=app

20th Feb 2019, 1:37 PM
Leto Gor🇲🇩
Leto Gor🇲🇩 - avatar
1 Odpowiedź
+ 11
Because you put empty string so it return "borders" between characters it is how it is counted - 1a2b3c4d5 so 5.
20th Feb 2019, 2:05 PM
Hubert Dudek
Hubert Dudek - avatar