Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from string import *
- key_s = str(raw_input("Enter the string you want to search. > "))
- target_s = str(raw_input("Enter what you are searching for. > "))
- x = 0
- recur_counter = 0
- def count_sub_string_match_recursive(key_s, target_s, x):
- x = find(key_s, target_s, x)
- global recur_counter
- if x >= 0:
- recur_counter += 1
- return count_sub_string_match_recursive (key_s, target_s, x+1)
- count_sub_string_match_recursive(key_s, target_s, x)
- print "This is how many times it shows up.", recur_counter
Advertisement
Add Comment
Please, Sign In to add comment