[prog] why doesn't this program work? (python)

Jacinta Richardson jarich at perltraining.com.au
Thu Dec 19 16:15:24 EST 2002


On Thu, 19 Dec 2002, Jacinta Richardson wrote:

> 
> It did come with indentation... perhaps it got stripped by some mailers?
> 
> Anyway I'm wondering whether the problem might be here:
> 
> guess = input("Guess a number: ")
> 
> In Perl at least, if I were to enter 
> 3
> that would be interpreted as "3\n" which would never be the same as "3".

I take it back.  "3" is never the same as "3\n" in string comparisons, but
"3\n" is always the same as 3 in integer comparisons so please ignore me.
Unless of course python doesn't have the same casting behaviours.
I have no idea what I was thinking when I made the above comment.

		Jacinta

--
   ("`-''-/").___..--''"`-._          |  Jacinta Richardson	    |
    `6_ 6  )   `-.  (     ).`-.__.`)  |  Perl Training Australia    |
    (_Y_.)'  ._   )  `._ `. ``-..-'   |      +613 9354 6001 	    |  
  _..`--'_..-_/  /--'_.' ,'           | contact at perltraining.com.au |
(il),-''  (li),'  ((!.-'              |   www.perltraining.com.au   |




More information about the Programming mailing list