I was trying to improve this little code by adding a tasks history option but I failed miserably. Whenever I run the code the tasks3 list resets. What can I do to save the recent tasks?
import random
N = int(input("Enter the number of tasks: "))
tasks = []
tasks3 = []
tasks2 = []
tasks1 = []
for i in range(N):
tasks.append(input("Please enter task: "))
print(i)
Wheel = random.randint(0, N-1)
print("\n", Wheel)
print("Your task now is " + tasks[Wheel])
print(tasks)
if tasks3 == [] :
tasks3 = tasks
else:
if tasks2 == [] :
tasks2 = tasks
else:
if tasks1 == [] :
tasks1 = tasks
else:
tasks3 = tasks2
tasks2 = tasks1
tasks1.clear()
print("Recent given tasks: ", "\n", tasks1, "\n", tasks2, "\n", tasks3)