Exercise 15: Multiple return

Python functions can return multiple variables. These variables can be stored in variables directly. A function is not required to return a variable, it can return zero, one, two or more variables.

This is a unique property of Python, other programming languages such as C++ or Java do not support this by default.

Example:

Study drill

Try the exercises below:

1. Create a function that returns a,b and a+b

After completing these continue with the next exercise.

Previous
Next

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">