r/pythonhelp • • Oct 15 '22

Getting count of string

Get Counts of (A, An, The) in a paragraph. The article should be given as input while running the script.

0 Upvotes

5 comments sorted by

View all comments

1

u/AmongstYou666 Oct 16 '22
a = "the rain in spain".split(' ')
count_these = "a an the".split(' ')
for i in count_these:
    print(i, a.count(i)

1

u/[deleted] Oct 16 '22

Thank you so much 🥰