Re: scratching my head on this
Hi there
You can solve this by generating a list which contains the permutations items. I've used a list compreension in the following code
I will post 2 solutions, one with the list compreension, the other will achieve the same thing just with an ordinary for loop without embedding in a list compreension. My communication skills suck as my english does, with that said, let's move on
solution 1:
import itertools
list= "coffee"
items = ["".join(word) for word in itertools.permutations(list)]
for i in items:
>print(i)
print(len(items))
solution 2>
import itertools
list = "coffee"
items = []
for word in itertools.permutations(list):
>print("".join(word))
>items.append(word)
print(len(items))
Let me know if you got any problemwith this and I hope I've been clear enough.
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector