I have a code that checks if the number in the range is even or odd and performs an operation on them respectively. It appends the results of the operation into a list. However, I am trying to append each instance of the for loop as a separate list within a list. How can I modify my code to do this?
series = []
for i in range(13, -0, -1):
while i > 1:
if i % 2 == 0:
i = i//2
series.append(i)
else:
i = i*3+1
series.append(i)
print(series)