[Tutor] Problems understanding code output

Andrew Van Valkenburg andrew.vanvalkenburg at gmail.com
Thu Jul 11 00:08:23 CEST 2013


I'm not really sure what you are asking, but the formatting for your code
is pretty screwy.  I reformatted it and changed the print statements
slightly to make it more readable and it works fine from what I can see.

def printMax(a, b):
  if a > b:
    print a, 'is maximum'
  elif a == b:
    print a, 'is equal to', b
  else: print b, 'is maximum'

printMax(3,4)


On Wed, Jul 10, 2013 at 5:05 PM, <ska at luo.to> wrote:

> def printMax(a, b): if a > b: print(a, 'is maximum') elif a == b: print(a,
> 'is equal to', b) else: print(b, 'is maximum') printMax(3, 4) # directly
> give literal values x = 5 y = 7 printMax(x, y) # give variables as
> arguments How the code above values to: 4 is maximum 7 is maximum and not
> to: 5 is maximum 7 is maximum This is going a little over my head, please
> advice, what am I missing in here?
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130710/a57aa1c3/attachment-0001.html>


More information about the Tutor mailing list