In python Preferably 343 Write a function that counts the oc
In python. Preferably 3.4.3
Write a function that counts the occurrences of a specified non-overlapping string s2 in another string s1 using the following header:
def count(s1, s2):
For example, count(\"system error, syntax error\", \"error\") returns 2. Write a test program that prompts the user to enter two strings and displays the number of occurences of the second string in the first string.
Solution
def count(s1, s2):
 count = start = 0
 while True:
 start = s1.find(s2, start) + 1
 if start > 0:
 count+=1
 else:
 return count
s1 = input(\"Enter String1\ \")
 s2 = input(\"Enter String2\ \")
 print(\"Occurence count of String2 in String1 is \",count(s1,s2))

