On 2017-04-03, Mats Wichmann <m...@wichmann.us> wrote:
> If you're talking about 4-digit year numbers using a Western
> calendar in digits of PI, the overlap effect seems unlikely to
> matter - let's say the year is 1919, do we think PI contains
> the sequence 191919? count would report back one instead of two
> in that case. In other cases it might matter; count is written
> specifically to not care about overlaps: "Return the number of
> (non-overlapping) occurrences"  So that's worth keeping in mind
> when you think about what you need from substrings-in-strings
> cases.

Composing a FSA (finite state automata) by hand would be an
excellent exercise in addition to covering the overlapping cases.

Another fun exercise might be to find the bithdays using
arithmetic operations instead of string operations.

-- 
Neil Cerutti

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to