fork(1) download
  1. yoba = [(None, None), (None, 'Smack my Bitch Up'), ('The Prodigy', None), ('The Prodigy', 'Smack my Bitch Up')]
  2.  
  3. def xstr(s):
  4. return '' if s is None else str(s)
  5.  
  6. def dologic(A, B):
  7. if (A and not B) or (not A and B):
  8. return xstr(A) + xstr(B)
  9. elif (A and B):
  10. return str(A) + ' - ' + str(B)
  11. else:
  12. return '...'
  13.  
  14. for A, B in yoba:
  15. print(dologic(A, B))
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
...
Smack my Bitch Up
The Prodigy
The Prodigy - Smack my Bitch Up