+ 2
Help with a substring length 2
I was practicing Python and came across this task. I canât understand why last2(âaxxxaaxxâ) Is returning 2 Ăan someone explain please? The task: Given a string, return the count of the number of times that a substring length 2 appears in the string and also as the last 2 chars of the string, so "hixxxhi" yields 1 (we won't count the end substring). last2('hixxhi') â 1 last2('xaxxaxaxx') â 1 last2('axxxaaxx') â 2 https://codingbat.com/prob/p145834
2 RĂ©ponses
+ 3
The function should count overlapping occurrences of the substring.
aXXxaaxx
axXXaaxx
+ 4
I got you, thank you Diego