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 as rd lista_studenti = ["Fabio", "Rita", "Francesca", "Paolo", "Luca", "Giacomo", "Ilaria", "Giovanni", "Elena", "Angelo"] def partner(x): n = len(x) rd.shuffle(x) for i in range(0, n, 2): print(x[i], "--", x[i+1]) partner(lista_studenti)