Record#
- Today's learning is to write a more complete todo list.
- It has four functions: add, remove, view, and edit.
CODE#
import os
print("🌟Life Organizer🌟")
print()
todolist = []
todoinfo = []
def todoprint():
for row in todolist:
for name in row:
print(f"{name: ^10}",end=" | ")
print()
select = "again"
while True:
os.system("clear")
if select == "again":
print("Menu: ")
print("1: Add ")
print("2: Remove ")
print("3: View ")
print("4: Edit ")
menu = input("")
if menu.strip().lower()[0] == "a":
task = input("What is the task? > ")
due = input("When is it due by? > ")
priority = input("What is the priority? > ")
todoinfo=[task,due,priority]
todolist.append(todoinfo)
print("Thanks, this task has been added.")
todoprint()
elif menu.strip().lower()[0] == "r":
name = input("Which one do you want remove? > ")
for row in todolist:
if name in row:
todolist.remove(row)
print("Thanks, this task has been removed.")
else:
print(f"{name} is not in the todolist")
elif menu.strip().lower()[0] == "v":
todoprint()
elif menu.strip().lower()[0] == "e":
name = input("Which one do you want remove? > ")
for row in todolist:
if name in row:
todolist.remove(row)
print("Thanks, this task has been removed.")
else:
print(f"{name} is not in the todolist")
task = input("What is the task? > ")
due = input("When is it due by? > ")
priority = input("What is the priority? > ")
todoinfo=[task,due,priority]
todolist.append(todoinfo)
print("Thanks, this task has been added.")
todoprint()
elif select == "quit":
break
select = input("Do you want to see the menu again or quit? ")