We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Strings
- Find a string
- Discussions
Find a string
Find a string
Sort by
recency
|
3424 Discussions
|
Please Login in order to post a comment
def count_substring(string, sub_string): j=0 for i in range(len(string)+1): if(string.find(sub_string,i,i+len(sub_string))>=0) : j = j+1 return j
Need Help!
Can anyone help me understand what is wrong with my code? I keep trying to understand but i cant get it right.
I think the issue is that you are overcomplicating it (too many lines), so you'll likely make lots of hard to fix small errors.
I recommend restarting from scratch with online help.
I've already done it. Yep had to start from the scratch. BTW thanks for the response. 😊