A function in Python can return multiple values using a _______.
- list
- return statement
- tuple
- yield statement
In Python, a function can return multiple values by using a tuple. A tuple is an ordered, immutable collection that allows you to return multiple values as a single object.
Loading...
Related Quiz
- If you want to make a variable defined in an outer function accessible to an inner function, you use the _______ keyword.
- What is the base class in Python from which all exceptions inherit?
- If you need to manage multiple resources simultaneously, the contextlib module provides a utility named _______ to nest context managers.
- You have written a function that accepts any number of positional and keyword arguments and prints them. However, the function signature does not specify any parameter names. How was this achieved?
- In Python, how do you define a method inside a class to access and modify the objects’ attributes?