My output is nothing, anyone here knows why? | Sololearn: Learn to code for FREE!

0

My output is nothing, anyone here knows why?

I am trying to make a list of possible permutations. Bslow is the code. Somebody help me because it outputs nothing. https://code.sololearn.com/cKkUqvfP4GbH/?ref=app

4/8/2021 11:28:38 PM

Weird Codem

3 Answers

New Answer

+2

What is the result that you're after? ['ab', 'ac', 'ad', 'ae', ...] ??? if so then print([''.join(e) for e in y]) This is the same as; l = [] for e in y: l.append(''.join(e)) print(l)

+1

for elems in y: x = "".join(elems) y.append(x) This creates an infinite loop. You're increasing the length of y with each iteration.

0

ChaoticDawg, what do you suggest? Doing if len(y) == 0 is also doing nothing.