I have a list I want to take random pieces out of that are 2 at a time. If my list is 1, 2, 3, 4, 5... I want to return 2 and 3 or 3 and 4 or 1 and 2 but not 1 and 4 etc. I know how to use random and its reading from a file and converted into a list called "word" so can I iterate over "word" and pull any two random words that are right next to each other and pass them in a pair to a new variable?
Aucun commentaire:
Enregistrer un commentaire