+ 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 Antworten
+ 3
The function should count overlapping occurrences of the substring.
aXXxaaxx
axXXaaxx
+ 4
I got you, thank you Diego