W3docs

Alternatives for returning multiple values from a Python function

Using a tuple:

  1. Using a tuple:

A function returning multiple values in Python

python— editable, runs on the server

<div class="alert alert-info flex not-prose"> Watch a course <span class="hidden md:block">Watch a video course </span> Python - The Practical Guide</div>

  1. Using a list:

A function returning a list in Python

python— editable, runs on the server
  1. Using a dictionary:

A function returning a dictionary in Python

python— editable, runs on the server
  1. Using an object:

A function returning an object in Python

python— editable, runs on the server