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?
CodePudding user response:
if items[0] ...:
...
Just refer to it as items[0]
, it has the same indexing manner as a list.
CodePudding user response:
Other comments/answers have pointed out the obvious, however, it would also be valid to say something like:
condition, value = test()
and to use:
if condition: ...