[Tutor] Compare function!
Sammy Cornet
corsam28 at hotmail.com
Mon Oct 14 16:41:43 CEST 2013
Hello!I´m using Idle (Python 2.7,5 version). I´m trying to write a program of compare function that returns 1 if a > b , 0 if a == b , and -1
if a < b . In which I´m want to get the user to prompt for the values of a and b. For some reason I can´t run it. The follwing is what I have written on my script:
def comparefunc (a, b): a = 3 b = 4 if a < b: return 1 elif a == b: return 0 elif a < b: return -1 print "return"
And, this is what I get for my output:
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32Type "copyright", "credits" or "license()" for more information.>>> ================================ RESTART ================================>>> >>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131014/3b99c99c/attachment.html>
More information about the Tutor
mailing list