using the "RANDOM" library mix a pre-existing list organizing the elements in coupes so that the programs gives each element another element different than itself.
import random def paring(l): to_be_shuffled = [] for i in range(len(l)): to_be_shuffled.append((l[i],l[i])) random.shuffle(to_be_shuffled) return to_be_shuffled ilist = [1, 2, 3, 4, 5] paring(ilist)