Q:

Get the frequency of a word from a string

so I'm having problem with finding the frequency of a word in a string. I'm trying to ask the user to input the string and the word. Let's say the user entered plopewdsplopewds and the word is "pewds" which is repeated twice.
The string.split() method here won't work.
I'm trying with it since hours and I couldn't find a decent working solution.
The use of for didn't work in this case.
If anyone has an idea please share it with me I have to do it today.
EDIT: I'm Trying to use a loop here. But I could only use it for characters:
text = input("text:\n> ")
char = input("character:\n> ")
def frequency(x):
  f=0
  for i in str(x):
    if (i == str(char)):
      f += 1
    else:
      f=f
  return f

print(frequency(text))

A:

I hope you can use count method
sampleString = "plopewdsplopewds"

print(sampleString.count("pewds"))

