Re: [Tutor] if statement problems(noob question)

2013-04-08 Thread Dave Angel
On 04/08/2013 07:55 AM, Steven D'Aprano wrote: On 08/04/13 20:45, Dave Angel wrote: will always fail, since the integer 2 is not equal to the type int. In Python 2.x, when you compare objects of different types, you generally get unequal. (Exception, if you define your own classes, you can def

Re: [Tutor] if statement problems(noob question)

2013-04-08 Thread Steven D'Aprano
On 08/04/13 20:21, Max Smith wrote: Hi, everyone whom might read this, im Max and i am really new to coding, been going at it for about two weeks using codeacademy and the book "think python". when i decided to experiment a little with if statements i ran into the following problem: def plus(x,y

Re: [Tutor] if statement problems(noob question)

2013-04-08 Thread Steven D'Aprano
On 08/04/13 20:45, Dave Angel wrote: will always fail, since the integer 2 is not equal to the type int. In Python 2.x, when you compare objects of different types, you generally get unequal. (Exception, if you define your own classes, you can define how they compare to others) In Python 3

Re: [Tutor] if statement problems(noob question)

2013-04-08 Thread Dave Angel
On 04/08/2013 06:37 AM, Woody 544 wrote: Max, You've made the arguments a string (so never a number) in: print "The answer is: " + str(x+y) MJ That has nothing to do with the issue. The str() function call is unnecessary, but harmless. If the two values x and y are ints or floats, they w

Re: [Tutor] if statement problems(noob question)

2013-04-08 Thread Dave Angel
On 04/08/2013 06:21 AM, Max Smith wrote: Hi, everyone whom might read this, im Max and i am really new to coding, been going at it for about two weeks using codeacademy and the book "think python". when i decided to experiment a little with if statements i ran into the following problem: def plu

Re: [Tutor] if statement problems(noob question)

2013-04-08 Thread Woody 544
Max, You've made the arguments a string (so never a number) in: print "The answer is: " + str(x+y) MJ On Apr 8, 2013 6:23 AM, "Max Smith" wrote: > Hi, everyone whom might read this, im Max and i am really new to coding, > been going at it for about two weeks using codeacademy and the book "thi