This programming language misconception is about
the meaning of Python's return
-statement
and the creation of tuples.
You see that the type of the result is tuple
.
Thus, a return
-statement puts comma-separated elements into a tuple,
and returns one value: the tuple.
There is no difference! Whether you write parentheses or not, Python creates a tuple when it encounters commas in that context.
If you would like to learn more about this misconception, including its possible origins, symptoms students who hold this misconception might exhibit, the related programming language concepts, links to the corresponding parts of the Python language specification, and related misconceptions, check out MultipleValuesReturn in the progmiscon.org misconception inventory.
This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.
MultipleValuesReturn
PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI
Privacy Policy • Platform Version 4c9a14b (Thu, 31 Jul 2025 09:00:13 GMT)