python 2.7 how to get bigger number between (a, b) [closed]

The reason why your code is failing is because the Max is not defined in the function so when you are returning, it seems unknown to your script, I guess you were trying to do something like:

def biggerNumber(a, b):
    maximum = 0
    if a>b:
     print " Max == a"
     maximum = a
    elif b>a:
      print "Max == b"
      maximum = b 
      print "a == b"  
      maximum = a         
    return maximum

print biggerNumber(10, 20)

Leave a Comment