"""Writecodein a function named count, to accepts astring and the letter as arguments.Find the number of times the lettrs appear in the string"""
p=input("Enter string:")
q=input("Enter character to check:")
def check(p,q):
if not p:
return 0
elif p[0]==q:
return 1+check(p[1:],q)
else:
return check(p[1:],q)
print("Count is:")
print(check(p,q))
No comments:
Post a Comment