0
help string permutation
https://sololearn.com/compiler-playground/cTHLRAnirS6N/?ref=app so i have this code and its outputting dog, odg, ogd, dgo, gdo, god but i need it to input dog, dgo, odg, ogd, gdo, god can someone help me figure out what to tweak thx
2 odpowiedzi
+ 2
Just swap the two for loops:
for index in range(len(aSet)):
for permutation in partial:
https://sololearn.com/compiler-playground/cQI9xhD23mAH/?ref=app
+ 1
maybe opt for a lazier solution:
also, most common Python libraries are written in C or C++, so they 're probably faster than pure Python solutions.
but implementing them yourself in Python is a good exercise in understanding the algorithm and getting proficient in the language you're learning.
https://sololearn.com/compiler-playground/cr89JTqZOOKG/?ref=app