Velocity Reviews > Re: Checking a Number for Palindromic Behavior

# Re: Checking a Number for Palindromic Behavior

Gary Herron
Guest
Posts: n/a

 10-18-2009
Benjamin Middaugh wrote:
> Thanks to everyone who helped with my query on reversing integers. I
> have one more simple problem I'm having trouble solving. I want to
> check a number for palindromic behavior (reading the same backwards
> and forwards). So if I have an integer 1457 it can tell me this is not
> the same from both ends but 1551 is. I think the simplest way would be
> to work inwards from both ends checking digits for equality, but I
> don't know enough (yet) to do this.
>
> All help is much appreciated.
>
> Benjamin

This problem (and the OP's previous problem) are probably homework
problems. If so, it was unethical for the student to ask for a
solution here, and it was careless of several responders to provide a
solution. Let's not make the same mistake this time.

Gary Herron

--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418

gslindstrom
Guest
Posts: n/a

 10-19-2009
On Oct 18, 5:56*pm, Gary Herron <(E-Mail Removed)> wrote:
> Benjamin Middaugh wrote:
> > Thanks to everyone who helped with my query on reversing integers. I
> > have one more simple problem I'm having trouble solving. I want to
> > check a number for palindromic behavior (reading the same backwards
> > and forwards). So if I have an integer 1457 it can tell me this is not
> > the same from both ends but 1551 is. I think the simplest way would be
> > to work inwards from both ends checking digits for equality, but I
> > don't know enough (yet) to do this.

>
> > All help is much appreciated.

>
> > Benjamin

>
> This problem (and the OP's previous problem) are probably homework
> problems. * If so, it was unethical for the student to ask for a
> solution here, and it was careless of several responders to provide a
> solution. * Let's not make the same mistake this time.
>
> Gary Herron

Could be. Or, like me, they could be working the Project Euler
problems. IIRC, many of the solutions involve checking for this type
of thing. I'd like to see the OP's work before we give our solutions,
though.

--greg

Ethan Furman
Guest
Posts: n/a

 10-19-2009
gslindstrom wrote:
> On Oct 18, 5:56 pm, Gary Herron <(E-Mail Removed)> wrote:
>
>>Benjamin Middaugh wrote:
>>
>>>Thanks to everyone who helped with my query on reversing integers. I
>>>have one more simple problem I'm having trouble solving. I want to
>>>check a number for palindromic behavior (reading the same backwards
>>>and forwards). So if I have an integer 1457 it can tell me this is not
>>>the same from both ends but 1551 is. I think the simplest way would be
>>>to work inwards from both ends checking digits for equality, but I
>>>don't know enough (yet) to do this.

>>
>>>All help is much appreciated.

>>
>>>Benjamin

>>
>>This problem (and the OP's previous problem) are probably homework
>>problems. If so, it was unethical for the student to ask for a
>>solution here, and it was careless of several responders to provide a
>>solution. Let's not make the same mistake this time.
>>
>>Gary Herron

>
>
> Could be. Or, like me, they could be working the Project Euler
> problems. IIRC, many of the solutions involve checking for this type
> of thing. I'd like to see the OP's work before we give our solutions,
> though.
>
> --greg

Absolutely. I have no issues asking for or receiving help for
apparently simple problems, but a description of what has been tried,
preferably with code snippets and results, should be included with the
request.

~Ethan~

rurpy@yahoo.com
Guest
Posts: n/a

 10-19-2009
On Oct 19, 12:41*pm, Ethan Furman <(E-Mail Removed)> wrote:
> gslindstrom wrote:
> > On Oct 18, 5:56 pm, Gary Herron <(E-Mail Removed)> wrote:

>
> >>Benjamin Middaugh wrote:

>
> >>>Thanks to everyone who helped with my query on reversing integers. I
> >>>have one more simple problem I'm having trouble solving. I want to
> >>>check a number for palindromic behavior (reading the same backwards
> >>>and forwards). So if I have an integer 1457 it can tell me this is not
> >>>the same from both ends but 1551 is. I think the simplest way would be
> >>>to work inwards from both ends checking digits for equality, but I
> >>>don't know enough (yet) to do this.

>
> >>>All help is much appreciated.

>
> >>>Benjamin

>
> >>This problem (and the OP's previous problem) are probably homework
> >>problems. * If so, it was unethical for the student to ask for a
> >>solution here, and it was careless of several responders to provide a
> >>solution. * Let's not make the same mistake this time.

>
> >>Gary Herron

>
> > Could be. *Or, like me, they could be working the Project Euler
> > problems. *IIRC, many of the solutions involve checking for this type
> > of thing. *I'd like to see the OP's work before we give our solutions,
> > though.

>
> > --greg

>
> Absolutely. *I have no issues asking for or receiving help for
> apparently simple problems, but a description of what has been tried,
> preferably with code snippets and results, should be included with the
> request.
>
> ~Ethan~

I agree such info *should* be included, but if it is
I can answer without such info, I will do so (although
perhaps while mentioning that the next time including
this out.) People in this group can be ****y enough
without my adding to it by insisting a poster jump
though some hoops before I'll spend my precious time
is not only to the benefit of the questioner, but
also to the benefit of many other silent readers
who shouldn't be penalized due to the faults of the
questioner.

Ethan Furman
Guest
Posts: n/a

 10-19-2009
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> On Oct 19, 12:41 pm, Ethan Furman <(E-Mail Removed)> wrote:
>
>>gslindstrom wrote:
>>
>>>On Oct 18, 5:56 pm, Gary Herron <(E-Mail Removed)> wrote:

>>
>>>>Benjamin Middaugh wrote:

>>
>>>>>Thanks to everyone who helped with my query on reversing integers. I
>>>>>have one more simple problem I'm having trouble solving. I want to
>>>>>check a number for palindromic behavior (reading the same backwards
>>>>>and forwards). So if I have an integer 1457 it can tell me this is not
>>>>>the same from both ends but 1551 is. I think the simplest way would be
>>>>>to work inwards from both ends checking digits for equality, but I
>>>>>don't know enough (yet) to do this.

>>
>>>>>All help is much appreciated.

>>
>>>>>Benjamin

>>
>>>>This problem (and the OP's previous problem) are probably homework
>>>>problems. If so, it was unethical for the student to ask for a
>>>>solution here, and it was careless of several responders to provide a
>>>>solution. Let's not make the same mistake this time.

>>
>>>>Gary Herron

>>
>>>Could be. Or, like me, they could be working the Project Euler
>>>problems. IIRC, many of the solutions involve checking for this type
>>>of thing. I'd like to see the OP's work before we give our solutions,
>>>though.

>>
>>>--greg

>>
>>Absolutely. I have no issues asking for or receiving help for
>>apparently simple problems, but a description of what has been tried,
>>preferably with code snippets and results, should be included with the
>>request.
>>
>>~Ethan~

>
>
> I agree such info *should* be included, but if it is
> I can answer without such info, I will do so (although
> perhaps while mentioning that the next time including
> such info would be helpful, if no one else had pointed
> this out.) People in this group can be ****y enough
> without my adding to it by insisting a poster jump
> though some hoops before I'll spend my precious time
> is not only to the benefit of the questioner, but
> also to the benefit of many other silent readers
> who shouldn't be penalized due to the faults of the
> questioner.

Your arguments are most persuasive. Consider me convinced.

Even if the worst-case scenario is true (homework problem, ack!), either
the poster will learn from the answer in which case all is well, or the
poster will not, in which case the final exam will show it.

~Ethan~

rurpy@yahoo.com
Guest
Posts: n/a

 10-19-2009
On Oct 18, 4:56*pm, Gary Herron <(E-Mail Removed)> wrote:
> Benjamin Middaugh wrote:
> > Thanks to everyone who helped with my query on reversing integers. I
> > have one more simple problem I'm having trouble solving. I want to
> > check a number for palindromic behavior (reading the same backwards
> > and forwards). So if I have an integer 1457 it can tell me this is not
> > the same from both ends but 1551 is. I think the simplest way would be
> > to work inwards from both ends checking digits for equality, but I
> > don't know enough (yet) to do this.

>
> > All help is much appreciated.

>
> > Benjamin

>
> This problem (and the OP's previous problem) are probably homework
> problems. * If so, it was unethical for the student to ask for a
> solution here, and it was careless of several responders to provide a
> solution. * Let's not make the same mistake this time.

You think that was homework? Perhaps so but for the record
here are some posts by some other people who suspected
homework in the very recent past...

2009-10-03
Chris Rebert wrote:
> Since this sounds like homework,

(E-Mail Removed) wrote:
> Thanks Chris, Not homework but self learning.

2009-10-01
Laszlo Nagy wrote:
> Is this a homework?

kj wrote:
> Earlier some other clown alleged that that my original post
> was homework??? WTF?

2009-09-27
John Nagle wrote
> This looks like a homework assignment.

> No this certainly isn't homework, I'm 29 and in full time work.

Steven D'Aprano
Guest
Posts: n/a

 10-20-2009
On Mon, 19 Oct 2009 13:29:52 -0700, Ethan Furman wrote:

> Your arguments are most persuasive. Consider me convinced.
>
> Even if the worst-case scenario is true (homework problem, ack!), either
> the poster will learn from the answer in which case all is well, or the
> poster will not, in which case the final exam will show it.

As far as I'm concerned, asking for help on homework without being honest
up-front about it and making an effort first, is cheating by breaking the
social contract. Anyone who rewards cheaters by giving them the answer
they want is part of the problem. Whether cheaters prosper in the long
run or not, they make life more difficult for the rest of us, and should
be discouraged.

Don't support cheaters and cheating. Don't buy from spammers, don't
reward people for bad behaviour, and don't do homework for students
(hints to help them learn is one thing) unless you know that their school
allows collaboration. To do otherwise is part of the problem.

--
Steven

Ethan Furman
Guest
Posts: n/a

 10-20-2009
Steven D'Aprano wrote:
> On Mon, 19 Oct 2009 13:29:52 -0700, Ethan Furman wrote:
>
>
>>Your arguments are most persuasive. Consider me convinced.
>>
>>Even if the worst-case scenario is true (homework problem, ack!), either
>>the poster will learn from the answer in which case all is well, or the
>>poster will not, in which case the final exam will show it.

>
>
> As far as I'm concerned, asking for help on homework without being honest
> up-front about it and making an effort first, is cheating by breaking the
> social contract. Anyone who rewards cheaters by giving them the answer
> they want is part of the problem. Whether cheaters prosper in the long
> run or not, they make life more difficult for the rest of us, and should
> be discouraged.
>
> Don't support cheaters and cheating. Don't buy from spammers, don't
> reward people for bad behaviour, and don't do homework for students
> (hints to help them learn is one thing) unless you know that their school
> allows collaboration. To do otherwise is part of the problem.

If you know that's the situation, absolutely. If you don't, it's a
judgement call.

~Ethan~

rurpy@yahoo.com
Guest
Posts: n/a

 10-20-2009
On 10/19/2009 03:24 PM, (E-Mail Removed) wrote:

> You think that was homework? Perhaps so but for the record
> here are some posts by some other people who suspected
> homework in the very recent past...

Updated...

2009-10-20
Gary Heron wrote:
> This problem (and the OP's previous problem) are probably homework
> problems

Benjamin Middaugh wrote:
> Actually I was working on a program to test the so-called 196-algorithm
> as an extracurricular activity.

2009-10-03
Chris Rebert wrote:
> Since this sounds like homework,

(E-Mail Removed) wrote:
> Thanks Chris, Not homework but self learning.

2009-10-01
Laszlo Nagy wrote:
> Is this a homework?

kj wrote:
> Earlier some other clown alleged that that my original post
> was homework??? WTF?

2009-09-27
John Nagle wrote
> This looks like a homework assignment.

> No this certainly isn't homework, I'm 29 and in full time work.

rurpy@yahoo.com
Guest
Posts: n/a

 10-20-2009
Why *not* answering a question in comp.lang.python
because you think it is homework is BAD.

1) It may look like a homework problem to you but it
probably isn't.

2) When you publicly accuse someone of "cheating" (and
even asking is tantamount to an accusation unless done
very tactfully), especially without anything more than
your "feelings" to back it up, you will likely anger
the poster, contribute to an generally unpleasant
atmosphere in the newsgroup, and intimidate other
people who want to ask legitimate questions.

3) You are not responding only to the original poster;
there are many other silent readers who are interested
in the answer and whom you are depriving of knowledge

4) When you post a specific solution to a question,
usually a number of other people will respond with
alternate or better solutions. While perhaps overkill
for the original poster who likely will be satisfied
with any answer, such discussion greatly benefits

5) Although "working out" an answer oneself is the usual
goal of homework problems, it is not the only way to
learn. Often, when one is really stuck, one can learn
what one is supposed to by seeing the fully worked out
the poster, are not in a position to decide for him/her
what the best way of learning is. The poster is also

the entire rest of the world, knowing nothing about the
particular circumstances of the poster.

7) If the poster is determined to cheat, he/she will do
stand will serve only to generate the above undesirable
results without changing the poster's behavior.

Of course, whether you choose to provide a specific
answer to something you think is homework, or not,
is ultimately a personal decision and you are free
that every other participant in this group adopt