Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Counting words in a string??

32 views
Skip to first unread message
Message has been deleted

Rob Gaddi

unread,
Sep 30, 2016, 2:47:41 PM9/30/16
to
Jake 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.
>
> It would help if you could comment the code.
> Thankyou in advance!!

I'm sure it would help; your professor will probably take points off
otherwise.

--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com

Email address domain is currently out of order. See above to fix.

srinivas devaki

unread,
Sep 30, 2016, 2:49:57 PM9/30/16
to
On Oct 1, 2016 12:10 AM, "Jake" <jakemo...@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

Jake

unread,
Sep 30, 2016, 3:12:47 PM9/30/16
to
----------
Could you make the program for me or provide an outline?

Peter Pearson

unread,
Sep 30, 2016, 3:13:29 PM9/30/16
to
On Fri, 30 Sep 2016 11:37:19 -0700 (PDT), Jake <jakemo...@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.
>
> It would help if you could comment the code.
> Thankyou in advance!!

Welcome to the Python newsgroup. Many helpful, capable, and polite
people frequent this newsgroup, but doing someone's homework assignment
is not viewed as helpful. If you write the code and run into a problem,
then you can post the code here (if it's short) with a specific question,
and will probably get a prompt and very helpful response.


--
To email me, substitute nowhere->runbox, invalid->com.

Chris Angelico

unread,
Sep 30, 2016, 3:48:26 PM9/30/16
to
On Sat, Oct 1, 2016 at 5:12 AM, Jake <jakemo...@gmail.com> wrote:
> Could you make the program for me or provide an outline?

No. In case you didn't read any of the other responses, this community
is not a plagiarism source. If you want to learn to be a programmer,
you're going to have to learn some key skills, one of which (possibly
the most important) is figuring out how to break a problem down into
its parts. Start work. If you don't have any clue how to start, ask
your professor - that way, it's not cheating.

Or if you don't HAVE a professor (if this is a coding challenge from a
self-paced online course, for instance), then you may need to consider
a pay-for course. A good few of these exist (check the Python Wiki for
some), and in some cases, you can get one-on-one tuition, which can
help you out enormously. But whether it's freely-given help on a
mailing list, group lectures, or personal tutoring, you won't get
people just giving you the code - not if they care about you becoming
a competent programmer, anyway.

ChrisA

bream...@gmail.com

unread,
Sep 30, 2016, 4:07:11 PM9/30/16
to
On Friday, September 30, 2016 at 8:12:47 PM UTC+1, Jake wrote:
> On Friday, 30 September 2016 19:49:57 UTC+1, srinivas devaki wrote:
> > On Oct 1, 2016 12:10 AM, "Jake" 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?

We'll start work as soon as your cheque made payable to the Python Software Foundation has been cashed. It works a bit like the Monty Python "Blackmail" sketch, the higher the grade you want, the more you have to pay.

mm0fmf

unread,
Sep 30, 2016, 4:07:11 PM9/30/16
to
How much will you pay for a commented program or an outline?
0 new messages