vendredi 24 juillet 2020

Distribute items from a list into a new list

I have some lists:

original = [1234, 2456, 1245, 5734, 1245, 74512, 13678, 1456, 3926, 1974]
list1 = []
list2 = []
list3 = []
list4 = []

I'm trying to move a certain amount of numbers from the original list into the new lists. list1 should have 4, list2 should have 3, list3 should 2, and list4 should have 1. The numbers that go into the new lists should be picked randomly and not in any particular order. There also shouldn't be any of the same numbers in 2 lists; all lists should have unique numbers. How should I solve this?




Aucun commentaire:

Enregistrer un commentaire