Computer >> Computer tutorials >  >> Programming >> Python

How can we return a tuple from a Python function?


We can return a tuple from a python function in many ways. For the given tuple, we define a  function as shown below.

Example

def foo():
    str = "tutorialspoint"
    x   = 30
    return (str, x);            
print foo()

Output

('tutorialspoint', 30)