# define string string = "Python is awesome, isn't it?" substring = "is" count = string.count(substring) # print count print("The count is:", count)
Here is what the above code is Doing:
1. We have a string variable named string.
2. We have a substring variable named substring.
3. We have a count variable that we set equal to string.count(substring).
4. We print the count variable.