0
How can I create a function that works like count whitout for in?
2 RĂ©ponses
+ 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