Help for permutaions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

16th Jun 2021, 2:25 PM
Ishara Malshan De Silva
Ishara Malshan De Silva - avatar
3 Answers
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 ......
16th Jun 2021, 5:51 PM
Ishara Malshan De Silva
Ishara Malshan De Silva - avatar
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
16th Jun 2021, 5:58 PM
visph
visph - avatar
- 1
from itertools import product, permutations [print(*i,sep='') for i in permutations((input()))]
16th Jun 2021, 2:44 PM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar