Skip to content

Commit

Permalink
Added functionality for retieving older sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
kom-senapati committed Sep 5, 2023
1 parent c582dec commit 0aad59e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion projects/ToDoList/to_do_list.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from pickle import dump,load


def add_task(task):
todo_list.append(task)
print("Task added!")
Expand Down Expand Up @@ -36,7 +39,13 @@ def get_choice():


if __name__ == "__main__":
todo_list = []

# Loading the pickle file into python as a list
try:
with open("todo.pickle","rb+") as file_in:
todo_list = load(file_in)
except FileNotFoundError:
todo_list = []

print("Welcome to ToDo List!")

Expand All @@ -62,12 +71,16 @@ def get_choice():

# Quit
elif user_choice == 4:
# Dumping the list into a pickle file
with open("todo.pickle","wb") as file_out:
dump(todo_list,file_out)
print("Goodbye!")
break


#####################################

# CODE CONTRIBUTED BY: Ota Hina
# Dynamic funcionality added by : komsenapati

#####################################

0 comments on commit 0aad59e

Please sign in to comment.