Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. todo = []
  2. answer = ""
  3.  
  4. while answer != "exit":
  5.     answer = input("Please specify a command [list, add, mark, archive, exit]: ")
  6.    
  7.     if answer == "list":
  8.         print("You saved the following to-do items:")
  9.         for index, item in enumerate(todo):
  10.           print(index + 1, "[x] " if item[0] else "[] ", item[1])
  11.  
  12.     elif answer == "add":
  13.         item = input("Add an item: ")
  14.         while len(item) == 0:
  15.             item = input("Add an item: ")
  16.         else:
  17.             todo.append([False, item])
  18.             print ("Item added")
  19.  
  20.     elif answer == "mark":
  21.                
  22.         print("You saved the following to-do items:")
  23.         for index, item in enumerate(todo):
  24.           print(index + 1, "[x] " if item[0] else "[] ", item[1])
  25.  
  26.         index = int(input("Which one you want to mark as completed:"))
  27.         todo[index - 1][0]= True
  28.        
  29.        
  30.         print("You have marked the following to-do items:")
  31.         for index, item in enumerate(todo):
  32.             print(index + 1, "[x] " if item[0] else "[] ", item[1])
  33.  
  34.     elif answer == "archive":
  35.         for i in todo:
  36.             if i[0] == True:
  37.             todo.remove[i]
  38.             print("All completed tasks got deleted.")        
  39.             else
  40.             print("You have no completed tasks.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement