Because in Python, every function returns a value, and None
is what is returned if you don't explicitly specify something else.
What exactly did you expect print(printmult(30))
to do? You've asked it to evaluate printmult(30)
, and then print
whatever results from that. Something has to result from it, right? Or were you maybe expecting some kind of exception to be raised?
Please be sure you understand that printing and returning are not the same thing.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…