progrmoiz / python-snippets

:100: The most useful python snippets
555 stars 121 forks source link

Remove `permute.py`? #8

Closed delirious-lettuce closed 6 years ago

delirious-lettuce commented 6 years ago

https://github.com/progrmoiz/python-snippets/blob/8d24dd5874d9e931f205b4ea700c974f60112307/permute.py#L1

In[22]: from itertools import permutations
In[23]: for p in permutations('maths'):
   ...:     print(''.join(p))
   ...: 
maths
matsh
mahts
mahst
masth
masht
mtahs
mtash
mthas
mthsa
mtsah
mtsha
mhats
mhast
mhtas
mhtsa
mhsat
mhsta
msath
msaht
mstah
mstha
mshat
mshta
amths
amtsh
amhts
amhst
amsth
amsht
atmhs
atmsh
athms
athsm
atsmh
atshm
ahmts
ahmst
ahtms
ahtsm
ahsmt
ahstm
asmth
asmht
astmh
asthm
ashmt
ashtm
tmahs
tmash
tmhas
tmhsa
tmsah
tmsha
tamhs
tamsh
tahms
tahsm
tasmh
tashm
thmas
thmsa
thams
thasm
thsma
thsam
tsmah
tsmha
tsamh
tsahm
tshma
tsham
hmats
hmast
hmtas
hmtsa
hmsat
hmsta
hamts
hamst
hatms
hatsm
hasmt
hastm
htmas
htmsa
htams
htasm
htsma
htsam
hsmat
hsmta
hsamt
hsatm
hstma
hstam
smath
smaht
smtah
smtha
smhat
smhta
samth
samht
satmh
sathm
sahmt
sahtm
stmah
stmha
stamh
stahm
sthma
stham
shmat
shmta
shamt
shatm
shtma
shtam
progrmoiz commented 6 years ago

Know there is already permutations Batteries Included