Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Checking a Number for Palindromic Behavior

Reply
Thread Tools

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

 
Reply With Quote
 
 
 
 
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
 
Reply With Quote
 
 
 
 
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~
 
Reply With Quote
 
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
relatively clear what the poster is asking about, and
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
answering. Another factor is an answer posted here
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.
 
Reply With Quote
 
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
> relatively clear what the poster is asking about, and
> 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
> answering. Another factor is an answer posted here
> 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~
 
Reply With Quote
 
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
http://groups.google.com/group/comp....74d426d30170e9
Chris Rebert wrote:
> Since this sounds like homework,

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


2009-10-01
http://groups.google.com/group/comp....85984ffc1dc5c3
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
http://groups.google.com/group/comp....74d426d30170e9
John Nagle wrote
> This looks like a homework assignment.

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

 
Reply With Quote
 
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
 
Reply With Quote
 
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~
 
Reply With Quote
 
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
http://groups.google.com/group/comp....8c5107e9d27bf#
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
http://groups.google.com/group/comp....734fce87cb1896
Chris Rebert wrote:
> Since this sounds like homework,

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


2009-10-01
http://groups.google.com/group/comp....85984ffc1dc5c3
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
http://groups.google.com/group/comp....74d426d30170e9
John Nagle wrote
> This looks like a homework assignment.

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

 
Reply With Quote
 
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.
See http://groups.google.com/group/comp....c6db43b09fdc92

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
by refusing to answer.

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
other readers.

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
problem's answer. You, who don't know anything about
the poster, are not in a position to decide for him/her
what the best way of learning is. The poster is also
free to ignore your answer if he/she chooses.

6) Please don't apply your abstract moral standards to
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
so with or without your help. Your self-righteous
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
to follow your conscious. Just please don't demand
that every other participant in this group adopt
your personal standards.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Checking a Number for Palindromic Behavior MRAB Python 7 10-19-2009 11:26 PM
Checking a Number for Palindromic Behavior Benjamin Middaugh Python 0 10-18-2009 07:13 PM
Determine if a character string is palindromic lovecreatesbeauty C Programming 25 05-09-2006 09:05 PM
OT: Number Nine, Number Nine, Number Nine FrisbeeŽ MCSE 37 09-26-2005 04:06 PM
undefined behavior or not undefined behavior? That is the question Mantorok Redgormor C Programming 70 02-17-2004 02:46 PM



Advertisments