fork download
  1. # your code goes here
  2. from itertools import product
  3. def mix(first,second):
  4. if not (bool(first) and bool(second)):
  5. return first+second
  6. el = next(product(first,second))
  7. if el[0] == el[1]:
  8. del first[first.index(el[0])], second[second.index(el[0])]
  9. return mix(first,second)
  10.  
  11.  
  12. x = mix([1,1,1,1],[1,1])
  13. print(x)
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
[1, 1]