Closed MarkCBell closed 2 years ago
Wow, thank you so much for spotting this. I implemented your fix (and credited you in the code)
I think you need to do two passes in order to also catch corner cases like calculate_pattern('rower', 'goner')
, which currently returns (1, 2, 0, 2, 2)
instead of (0, 2, 0, 2, 2)
.
For example,
calculate_pattern('meets', 'weary')
currently returns(0, 2, 1, 0, 0)
, however the correct pattern should be(0, 2, 0, 0, 0)
since there is not a seconde
in the target word. One way to do this correctly is:you just need to then call this as
tuple(calculate_pattern(word, word2))
.