Create a nested list object with an arbitrary depth
Problem Description:
I want to create a nested list object. In this way, the user enters a positive integer, then add empty lists to the initial list, equal to the number entered by the user. The second list should be added to the first list, the third list should be added to the second list, the fourth list should be added to the third list, and so on.
How can I do this using Python?
Example in the picture:
Solution – 1
a = []
for _ in range(x):
a = [a]