[Tutor] Creating lists with definite (n) items without repetitions

Marcus Lütolf marcus.luetolf at bluewin.ch
Thu Sep 3 15:32:52 CEST 2015


dear pythonistats
as a newcomber I want to create a set of lists containing n items, for 
example n = 3:  (['a','b','c'], ['a','d','e'].......).
The sequence of items in each list should be different. If the letters 
'a'........'z' are used and n = 3 there is a maximum of 301 lists.
The following code works only for lists containing 1 item:

import random
list = ['a', 'b', 'c', 'd',....... 'z']
random.shuffle(list)
for x in list:
     print x

how can I solve my task wit n items ?
Thank you for help, Marcus.

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



More information about the Tutor mailing list