Search code examples
pythonif-statementreturn-value

How to use one of the tuple return values from a function in a nested elif in python?


def test():
    return(True, '123')

items = test()

I need to use return value of items[0] as a test condition in a nested else if statement. How do I do it at the else if statement?


Solution

  • this syntax works without requiring a handle

    if a > b: do task elif test()[0]: do task