Counting Pattern Matches

Welcome to the Get Help category!

This is where you can ask questions about your code. Some important things to remember when posting in this category :slight_smile:

  • Learn how to ask a good question and get a good answer!
  • Remember to include a link to the exercise you need help with!
  • If someone answers your question, please mark their response as a solution :white_check_mark:
  • Once you understand a new concept, come back and try to help someone else!

So I was cruising through the lesson when I found that #1 couldn’t be solved properly, I got the answer but could someone explain why it doesn’t work?

https://www.codecademy.com/paths/computer-science/tracks/cspath-cs-102/modules/pattern-searching/lessons/naive-pattern-search-python-implementation/exercises/counting-pattern-matches

that’s the link to the question

here’s the link to the “wrong answer”

Here’s the fixed version

Why is the first strategy wrong? I get the logic behind it but the check answer seems to say the first version was correct, any explanation plz? and why oddest it work?

Hi so I think that you may be doing a mistake somewhere I will try to find it asap. Thanks!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.