二手产品经理

二手产品经理

THIS IS RENO

Comprehensive Practice - 45 Days - Learn Python Online in 100 Days

Record#

  1. Today's learning is to write a more complete todo list.
  2. 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? ")

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.