fork download
  1. # your code goes here
  2. from itertools import product
  3. from random import randint
  4.  
  5. def mix(first,second):
  6. my_gen = product(first,second)
  7. for el in my_gen:
  8. if el[0] == el[1]:
  9. del first[first.index(el[0])], second[second.index(el[0])]
  10. return mix(first,second)
  11. return first+second
  12.  
  13. seq1 = [randint(0,10) for i in range(randint(20,100))]
  14. seq2 = [randint(0,10) for i in range(randint(20,100))]
  15. print(seq1)
  16. print(seq2)
  17. x = mix(seq1,seq2)
  18. print(x)
Success #stdin #stdout 0.03s 12320KB
stdin
Standard input is empty
stdout
[8, 7, 3, 8, 7, 1, 4, 6, 7, 9, 8, 6, 9, 0, 6, 8, 2, 3, 6, 2, 10, 10, 2, 9, 5, 2, 3, 3, 3, 2]
[0, 2, 5, 3, 5, 9, 4, 4, 4, 7, 1, 9, 4, 0, 8, 4, 4, 6, 2, 1, 0, 1, 0, 5, 5, 1, 4, 8, 5, 8, 7, 1, 4, 5, 6, 7, 5, 8, 9, 9, 8, 7, 3, 6, 7, 9, 2, 2, 3, 2, 7, 10, 1]
[6, 10, 3, 3, 5, 4, 4, 4, 0, 4, 4, 1, 0, 1, 0, 5, 5, 1, 4, 5, 1, 4, 5, 5, 9, 8, 7, 7, 9, 7, 1]