Here we will discuss some ways to return multiple values from a function in python for data science.
- Using Object: In this, a class is there to hold multiple values and return an object of the class.
- Using Tuple: A comma-separatable item in a sequence is a Tuple. It can be created either by using or not using parenthesis. Tuples are immutable in nature.
- Using a List: It is similar to arrays, but it consists of square brackets. One more dissimilarity is that lists can contain different types of items. Lists are mutable in nature.
- Using a Dictionary: As other languages have hash or map, similarly Python has dictionary.