On Beyond Strings


#1


Just a query about following code.
Why we are using return statement, "return max(args)"

In the following code, when I put a comment on return statement, there was no difference in the output

https://www.codecademy.com/en/courses/python-beginner-c7VZg/3/1?curriculum_id=4f89dab3d788890003000096


Replace this line with your code. 
def biggest_number(*args):
    print max(args)
    #return max(args)
    
def smallest_number(*args):
    print min(args)
    #return min(args)

def distance_from_zero(arg):
    print abs(arg)
    return abs(arg)


biggest_number(-10, -5, 5, 10)
smallest_number(-10, -5, 5, 10)
distance_from_zero(-10)


#2

They work because you are printing inside the functions. The ones with no return are returning None.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.