Counting words in a string??

Jake jakemorroll18 at gmail.com
Fri Sep 30 15:12:12 EDT 2016


On Friday, 30 September 2016 19:49:57 UTC+1, srinivas devaki  wrote:
> On Oct 1, 2016 12:10 AM, "Jake" <jakemorroll18 at gmail.com> wrote:
> >
> > Hi, I need a program which:
> > 1) Asks the user for a sentence of their choice (not including
> punctuation)
> > 2) Ask the user which word they would like to know is repeated
> > 3) Print out to the user how many times the word came up which they chose
> from their sentence.
> >
> 
> typical home work assignment, even though stop asking for programs and
> start asking how to make the same.
> 
> anyway if you ever try to write code for this you have to split you
> sentence and use a dict for counting
> 
> Python has Counter from collections but it is a little bit slower when
> compared to defaultdict for this kind of purpose.
> 
> Regards
> Srinivas Devaki
> Senior (final yr) student at Indian Institute of Technology (ISM), Dhanbad
> Computer Science and Engineering Department
> ph: +91 9491 383 249
> telegram_id: @eightnoteight

----------
Could you make the program for me or provide an outline?



More information about the Python-list mailing list