How can we return a tuple from a Python function?

PythonServer Side ProgrammingProgramming

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)
raja
Published on 07-Dec-2017 16:29:52
Advertisements