Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- todo = []
- answer = ""
- while answer != "exit":
- answer = input("Please specify a command [list, add, mark, archive, exit]: ")
- if answer == "list":
- print("You saved the following to-do items:")
- for index, item in enumerate(todo):
- print(index + 1, "[x] " if item[0] else "[] ", item[1])
- elif answer == "add":
- item = input("Add an item: ")
- while len(item) == 0:
- item = input("Add an item: ")
- else:
- todo.append([False, item])
- print ("Item added")
- elif answer == "mark":
- print("You saved the following to-do items:")
- for index, item in enumerate(todo):
- print(index + 1, "[x] " if item[0] else "[] ", item[1])
- index = int(input("Which one you want to mark as completed:"))
- todo[index - 1][0]= True
- print("You have marked the following to-do items:")
- for index, item in enumerate(todo):
- print(index + 1, "[x] " if item[0] else "[] ", item[1])
- elif answer == "archive":
- for i in todo:
- if i[0] == True:
- todo.remove[i]
- print("All completed tasks got deleted.")
- else
- print("You have no completed tasks.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement