Return statement

def max(x, y): if x >=y: print (x) else: print (y) k= max(6,7) print (k) Do u know why when i replace 'return' to 'print' , it has ' None'. Please explain tks !

7/14/2019 4:36:37 PM

Lewsijght G

2 Answers

New Answer


Every function that doesn't explicitly return something, returns None instead.


you can try this: instead of printing in the function return the max value. def max(x, y): if x >=y: return x else: return y print(max(6,7))