My output is nothing, anyone here knows why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

8th Apr 2021, 11:28 PM
Weird Codem
3 Answers
+ 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)
9th Apr 2021, 12:32 AM
ChaoticDawg
ChaoticDawg - avatar
+ 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.
9th Apr 2021, 12:20 AM
ChaoticDawg
ChaoticDawg - avatar
0
ChaoticDawg, what do you suggest? Doing if len(y) == 0 is also doing nothing.
9th Apr 2021, 12:28 AM
Weird Codem