-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.py
More file actions
48 lines (44 loc) · 1.48 KB
/
task.py
File metadata and controls
48 lines (44 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from database import add, list,edit,done,delete, reset_table
from tabulate import tabulate
def main():
while True:
print("--- Task CLI App---")
print("1. Add To-do list")
print("2. List task on to-do list")
print("3. Edit to-do list")
print("4. done to-do list")
print("5. Delete to-do list")
print("6. reset_table")
print("7. Exit")
choice = input("Choose an option: ")
if choice == "1":
description = input("enter to-do list description:")
add(description)
elif choice == "2":
task =list()
print(tabulate(task, headers=["id", "description", "status"],
tablefmt="grid"))
elif choice == "3":
id = int(input("enter id:"))
edited_description =input("enter new description:")
edit(id, edited_description)
elif choice == "4":
id = input("enter id:")
done(id)
elif choice == "5":
id = input("enter id:")
delete(id)
elif choice == "6":
confirm = input("Are you sure you want to reset? " \
"(yes/no):").lower()
if confirm=="yes":
reset_table()
else:
print("reset cancelled")
elif choice == "7":
print("Goodbye ")
break
else:
print(" Invalid choice. Try again.")
if __name__== "__main__":
main()