This came up while talking to a friend and I thought I\'d ask here since it\'s an interesting problem and would like to see other people\'s solutions.
The task is to
Python version of the first voted answer.
def foo(output, open, close, pairs): if open == pairs and close == pairs: print output else: if open