Question

New Arrivals-Princess Polly USA Ho Schedules ietz - Computational Reasoning 1 Fall 2019/ INFO1201-F19 /21 October -27 October
0 0
Add a comment Improve this question Transcribed image text
Answer #1

# The definition of the function

def returnLetterCount(aString,letterToFind):

    # We keep a track for counting the number of occurences of lettertofind

    count=0

    for character in aString:

        # If the character is equal to the lettertofind we increment count by 1

        if character==letterToFind:

            count+=1

    return count

print(returnLetterCount("ababa","a"))

print(returnLetterCount("sasabbbbbcccccrererere","s"))

print(returnLetterCount("qwerty","q"))

print(returnLetterCount("apple","s"))

Hope this helps you..

In case of any queries feel free to ask in the comments section

Happy Coding :) :)

Add a comment
Know the answer?
Add Answer to:
New Arrivals-Princess Polly USA Ho Schedules ietz - Computational Reasoning 1 Fall 2019/ INFO1201-F19 /21 October...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT