-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskManager.py
More file actions
86 lines (77 loc) · 2.06 KB
/
TaskManager.py
File metadata and controls
86 lines (77 loc) · 2.06 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#to create a task manger or to- do list
#from operator import delitem
list=[]
attach=[]
user_name=input("Enter Name-->")
print(f"Welcome {user_name}!! Try This App\nTo Create To-do List ")
def user_task():
#ask for number of task
ask=int(input("Enter Number Of Task:"))
for i in range(1,ask+1):
user_task=input(f"{i}.Enter Task {i}-->")
attach=list.append(user_task)
print(f"Task added successfully")
#to view task
def view_task():
print(f"{list}")
#to include new task
def add_task():
new_task=input(f"Type New Task-->")
attach=list.append(new_task)
print(f'New task added successfully')
#to delete task
def delete_task():
task=input(f'Enter Task To be Deleted-->')
if task in list:
position=list.index(task)
del list[position]
print(f'Task deleted successfully')
else:
print(f"Unable To fetch Enter Exact Value")
delete_task()
#To update task
def update_task():
global list
exist_task=input(f'Which Task You want to Update-->')
if exist_task in list:
object=list.index(exist_task)
new_task=input(f'Enter New Task-->')
list[object]=new_task
print(f'Item Updated Successfully')
else:
print(f"Unable To fetch Enter Exact Value")
update_task()
# Display main menu Ui
def menu():
print(f"\n1.Create task list")
print(f"2.Add task")
print(f"3.view task")
print(f"4.Delete task")
print(f"5.Update task")
print(f"6.Exit")
#menu()
#It will run until user press 6 for exit
def run_code():
menu()
user_choice=int(input(f"Enter Choice-->"))
if user_choice==1:
user_task()
run_code()
elif user_choice==2:
add_task()
run_code()
elif user_choice==3:
view_task()
run_code()
elif user_choice==4:
delete_task()
run_code()
elif user_choice==5:
update_task()
run_code()
elif user_choice==6:
print(f"You Have Successfully Exit")
else:
print(f"Invalid Choice\nTry Again !")
run_code()
run_code()