google.com, pub-7659628848972808, DIRECT, f08c47fec0942fa0 Pro Learner: Writecodein a function named count, to accepts astring and the letter as arguments.Find the number of times the lettrs appear in the string in python

Please click on ads

Please click on ads

Friday 26 February 2021

Writecodein a function named count, to accepts astring and the letter as arguments.Find the number of times the lettrs appear in the string in python

 """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