Python - How to Return Multiple Values From a Function

preview_player
Показать описание
#Python #Shorts

What may be frowned upon in one language seems to be a perfectly reasonable thing to do in Python. Partially, thanks to the unpacking feature. But if you ever want to return more than one value from a function, just put all of them separated by a comma after your "return" statement. This will actually return these values as a tuple but you can easily unpack it into multiple variables, or just keep using the tuple. It's all up to you.
-------------------------------------------------------------------------------------
Links:
Рекомендации по теме