yet another noob question

Jason Nordwick jason at adapt.com
Sun Aug 13 20:19:19 EDT 2006


def pr(x): print(x)

>>> x=map(pr,[x for x in xrange(11,56) if '1'<=min(str(x)) and max(str(x))<='5'])
11
12
13
14
15
21
22
23
24
25
31
32
33
34
35
41
42
43
44
45
51
52
53
54
55


mike_wilson1333 wrote:
> I would like to generate every unique combination of numbers 1-5 in a 5
> digit number and follow each combo with a newline.  So i'm looking at
> generating combinations such as: (12345) , (12235), (55554) and so on.
> What would be the best way to do this? So, basically i'm looking for a
> list of all combinations of 1-5 in a 5 digit unique number. Also, when
> I send the list to print there can't be any duplicates of the combos.
> 
> 
>       Thanks,
> 
>       Mike
> 




More information about the Python-list mailing list