str.count counts non-overlapping instances of the substring. After
counting the first 'AA', there is only one A left, so that isn't a
second instance of 'AA'


On 2018-04-25 02:22 PM, Julia Kim wrote:
> Hi,
>
> There’s an error with the string method count().
>
> x = ‘AAA’
> y = ‘AA’
> print(x.count(y))
>
> The output is 1, instead of 2.
>
>
> I write programs on SoloLearn mobile app.
>
>
>
> Warm regards,
> Julia Kim
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to