I am learning Python these days and I want to ask which code is better to write and applicable in real world or used in practice actually? Both codes are giving the same output though. In first function, I used return inside and then had to use print when it comes to invoking. While on the other hand, I used print inside and then just call the function. So, which is a good practice?
And apart from that, many times I would need to get many things inside my function and I will have an option to either get it back through "print" and "return" - so also in those conditions, what should I do ideally and what is being used in practice?
def min_func(values):
return min(values)
print(min_func([3, 41, 12, 9, 74, 15]))
def min_func(values):
print(min(values))
min_func([3, 41, 12, 9, 74, 15])
printis enough