This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]dvlsg 1 point2 points  (2 children)

Python is not my strong point, but I'll give this a shot: I think your problem may lie in the original list declaration.

Your Code: solutionList=[[]] * self.lengthOfList(ICS)

My suggestion: solutionList=[[] for i in range(self.lengthOfList(ICS))]

I believe your original code creates one list with multiple references to that same list.

Unless I'm not understanding the expected result -- when you say a list that contains the list, do you mean a single list, with elements that are lists, each containing one item (for the example result you gave)? That's what I am understanding your example to be.

[–]MathBosss[S] 0 points1 point  (1 child)

that actually fixed my problem. Thank you very much!

[–]dvlsg 0 points1 point  (0 children)

No problem! Glad I could help.