0
Why is "None" an output?
def max(x, y): if x >y: return x elif x==y: print("Equal") else: return y print(max(7,7))
2 Respostas
+ 3
because instead of returning "Equal" you print it in the function... other statements are not executed since x==y, so value implicitly returned by function is None...
the output is:
Equal
None
+ 2
Kristóf Pintér ,
additional to the comments given by visph, you should NOT use " max" as a name for a user defined function. max() is a build-in function of python. using the same name for your own function can lead to trouble and may create problems that are not easy to catch.