0
Help for permutaions
PYTHON ONLY Input--> any word or something(ex: ab) Output should be all permutations of input. Andalso it should not contain similar outputs (ex: ab,ab). Further all these permutations should enter into a text file automatically. Ex: a b ab ba Help me to solve this
3 Antworten
0
Dear how to upgrade this code. It should print like this.
a
b
c
ab
ac
ba
bc
ca
cb
abc
acb
bac
bca
......
0
https://code.sololearn.com/c1rXHbf2uQxf/?ref=app
take inputs as one lined strings space separated, output to file(s) and print the file...
example input:
aab baa abc
will create 2 files and 3 outputs:
aab => file: aab.txt created
a
b
...
baa
baa => file: aab.txt still created
a
b
...
baa
abc => file: abc.txt created
a
b
...
cba
- 1
from itertools import product, permutations
[print(*i,sep='') for i in permutations((input()))]