0
How can I create a function that works like count whitout for in?
2 ответов
+ 3
def count_p(x,y):
p=x.split(y)
return len(p)-1
Here count_p takes 2 parem a string and a substring
For example:—
p = count_p("ayush kumar singh","a")
print(p)
Output:– 2