given that s = "awesome" the function triangle() can be written as a simple expression:
[[s[:i+1]] for i in range(len(s))]
without the useless list allocation at the beginning, the problem mentioned in the post is eliminated
Agreed, and kudos for writing it in a "Pythonic" way; but the point of the problem, and hence this story, is not to have it implemented in the simplest way possible, but to make sure that the concept of mutability is well understood. Thanks for the reply, anyway! :)