Skip to content

Commit 8a44aba

Browse files
authoredDec 21, 2023
Add files via upload
new addition to examples : Task tacker that can be used to track the tasks with prioroty set for each task
1 parent b5c8668 commit 8a44aba

File tree

1 file changed

+550
-0
lines changed

1 file changed

+550
-0
lines changed
 

‎Task Tracker.ipynb

+550
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,550 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 0,
4+
"metadata": {
5+
"colab": {
6+
"provenance": []
7+
},
8+
"kernelspec": {
9+
"name": "python3",
10+
"display_name": "Python 3"
11+
},
12+
"language_info": {
13+
"name": "python"
14+
}
15+
},
16+
"cells": [
17+
{
18+
"cell_type": "code",
19+
"execution_count": 15,
20+
"metadata": {
21+
"colab": {
22+
"base_uri": "https://localhost:8080/"
23+
},
24+
"id": "y6Ou-6FuS8X8",
25+
"outputId": "7ad6bc08-5850-4b08-f0c2-439b5cc23ce4"
26+
},
27+
"outputs": [
28+
{
29+
"output_type": "stream",
30+
"name": "stdout",
31+
"text": [
32+
"*********Welcome to Task Tracker**********\n",
33+
"\n",
34+
"\n",
35+
"Task Tracker Menu: \n",
36+
"\n",
37+
"1. Add Task\n",
38+
"\n",
39+
"2. Display All Taks\n",
40+
"\n",
41+
"3. Delete Task\n",
42+
"\n",
43+
"4. Mark Task as Completed\n",
44+
"\n",
45+
"5. Update Task Priority\n",
46+
"\n",
47+
"6. Exit \n",
48+
"\n",
49+
"\n",
50+
"Enter your choice (1-6) : 2\n",
51+
"\n",
52+
"\n",
53+
"No tasks to display\n",
54+
"\n",
55+
"\n",
56+
"\n",
57+
"*********Welcome to Task Tracker**********\n",
58+
"\n",
59+
"\n",
60+
"Task Tracker Menu: \n",
61+
"\n",
62+
"1. Add Task\n",
63+
"\n",
64+
"2. Display All Taks\n",
65+
"\n",
66+
"3. Delete Task\n",
67+
"\n",
68+
"4. Mark Task as Completed\n",
69+
"\n",
70+
"5. Update Task Priority\n",
71+
"\n",
72+
"6. Exit \n",
73+
"\n",
74+
"\n",
75+
"Enter your choice (1-6) : 1\n",
76+
"\n",
77+
"Enter Task Name : Do Homework\n",
78+
"\n",
79+
"Enter Task Due Date (MM/DD/YYYY): 12/06/2023\n",
80+
"\n",
81+
"Enter Task Priority(High / Low / Medium) : low\n",
82+
"*********Welcome to Task Tracker**********\n",
83+
"\n",
84+
"\n",
85+
"Task Tracker Menu: \n",
86+
"\n",
87+
"1. Add Task\n",
88+
"\n",
89+
"2. Display All Taks\n",
90+
"\n",
91+
"3. Delete Task\n",
92+
"\n",
93+
"4. Mark Task as Completed\n",
94+
"\n",
95+
"5. Update Task Priority\n",
96+
"\n",
97+
"6. Exit \n",
98+
"\n",
99+
"\n",
100+
"Enter your choice (1-6) : 1\n",
101+
"\n",
102+
"Enter Task Name : Complete project\n",
103+
"\n",
104+
"Enter Task Due Date (MM/DD/YYYY): 12/12/2023\n",
105+
"\n",
106+
"Enter Task Priority(High / Low / Medium) : Medium\n",
107+
"*********Welcome to Task Tracker**********\n",
108+
"\n",
109+
"\n",
110+
"Task Tracker Menu: \n",
111+
"\n",
112+
"1. Add Task\n",
113+
"\n",
114+
"2. Display All Taks\n",
115+
"\n",
116+
"3. Delete Task\n",
117+
"\n",
118+
"4. Mark Task as Completed\n",
119+
"\n",
120+
"5. Update Task Priority\n",
121+
"\n",
122+
"6. Exit \n",
123+
"\n",
124+
"\n",
125+
"Enter your choice (1-6) : 1\n",
126+
"\n",
127+
"Enter Task Name : Prepare Presentation\n",
128+
"\n",
129+
"Enter Task Due Date (MM/DD/YYYY): 12/12/2023\n",
130+
"\n",
131+
"Enter Task Priority(High / Low / Medium) : Medium\n",
132+
"*********Welcome to Task Tracker**********\n",
133+
"\n",
134+
"\n",
135+
"Task Tracker Menu: \n",
136+
"\n",
137+
"1. Add Task\n",
138+
"\n",
139+
"2. Display All Taks\n",
140+
"\n",
141+
"3. Delete Task\n",
142+
"\n",
143+
"4. Mark Task as Completed\n",
144+
"\n",
145+
"5. Update Task Priority\n",
146+
"\n",
147+
"6. Exit \n",
148+
"\n",
149+
"\n",
150+
"Enter your choice (1-6) : 1\n",
151+
"\n",
152+
"Enter Task Name : Give Final exam\n",
153+
"\n",
154+
"Enter Task Due Date (MM/DD/YYYY): 12/06/2023\n",
155+
"\n",
156+
"Enter Task Priority(High / Low / Medium) : High\n",
157+
"*********Welcome to Task Tracker**********\n",
158+
"\n",
159+
"\n",
160+
"Task Tracker Menu: \n",
161+
"\n",
162+
"1. Add Task\n",
163+
"\n",
164+
"2. Display All Taks\n",
165+
"\n",
166+
"3. Delete Task\n",
167+
"\n",
168+
"4. Mark Task as Completed\n",
169+
"\n",
170+
"5. Update Task Priority\n",
171+
"\n",
172+
"6. Exit \n",
173+
"\n",
174+
"\n",
175+
"Enter your choice (1-6) : 2\n",
176+
"\n",
177+
"Task Tracker\n",
178+
"\n",
179+
"\n",
180+
"\n",
181+
"Task Name Due Date Priority Status \n",
182+
"Do Homework 12/06/2023 low Pending \n",
183+
"Complete project 12/12/2023 Medium Pending \n",
184+
"Prepare Presentation 12/12/2023 Medium Pending \n",
185+
"Give Final exam 12/06/2023 High Pending \n",
186+
"\n",
187+
"\n",
188+
"\n",
189+
"*********Welcome to Task Tracker**********\n",
190+
"\n",
191+
"\n",
192+
"Task Tracker Menu: \n",
193+
"\n",
194+
"1. Add Task\n",
195+
"\n",
196+
"2. Display All Taks\n",
197+
"\n",
198+
"3. Delete Task\n",
199+
"\n",
200+
"4. Mark Task as Completed\n",
201+
"\n",
202+
"5. Update Task Priority\n",
203+
"\n",
204+
"6. Exit \n",
205+
"\n",
206+
"\n",
207+
"Enter your choice (1-6) : 3\n",
208+
"\n",
209+
"Enter Task Name : homeowork\n",
210+
"Task 'homeowork' not found.\n",
211+
"\n",
212+
"\n",
213+
"\n",
214+
"*********Welcome to Task Tracker**********\n",
215+
"\n",
216+
"\n",
217+
"Task Tracker Menu: \n",
218+
"\n",
219+
"1. Add Task\n",
220+
"\n",
221+
"2. Display All Taks\n",
222+
"\n",
223+
"3. Delete Task\n",
224+
"\n",
225+
"4. Mark Task as Completed\n",
226+
"\n",
227+
"5. Update Task Priority\n",
228+
"\n",
229+
"6. Exit \n",
230+
"\n",
231+
"\n",
232+
"Enter your choice (1-6) : 3\n",
233+
"\n",
234+
"Enter Task Name : do homework\n",
235+
"Task 'do homework' deleted.\n",
236+
"*********Welcome to Task Tracker**********\n",
237+
"\n",
238+
"\n",
239+
"Task Tracker Menu: \n",
240+
"\n",
241+
"1. Add Task\n",
242+
"\n",
243+
"2. Display All Taks\n",
244+
"\n",
245+
"3. Delete Task\n",
246+
"\n",
247+
"4. Mark Task as Completed\n",
248+
"\n",
249+
"5. Update Task Priority\n",
250+
"\n",
251+
"6. Exit \n",
252+
"\n",
253+
"\n",
254+
"Enter your choice (1-6) : 2\n",
255+
"\n",
256+
"Task Tracker\n",
257+
"\n",
258+
"\n",
259+
"\n",
260+
"Task Name Due Date Priority Status \n",
261+
"Complete project 12/12/2023 Medium Pending \n",
262+
"Prepare Presentation 12/12/2023 Medium Pending \n",
263+
"Give Final exam 12/06/2023 High Pending \n",
264+
"\n",
265+
"\n",
266+
"\n",
267+
"*********Welcome to Task Tracker**********\n",
268+
"\n",
269+
"\n",
270+
"Task Tracker Menu: \n",
271+
"\n",
272+
"1. Add Task\n",
273+
"\n",
274+
"2. Display All Taks\n",
275+
"\n",
276+
"3. Delete Task\n",
277+
"\n",
278+
"4. Mark Task as Completed\n",
279+
"\n",
280+
"5. Update Task Priority\n",
281+
"\n",
282+
"6. Exit \n",
283+
"\n",
284+
"\n",
285+
"Enter your choice (1-6) : 4\n",
286+
"Enter task name to mark as completed : Give Final exam\n",
287+
"Task 'Give Final exam' marked as completed.\n",
288+
"*********Welcome to Task Tracker**********\n",
289+
"\n",
290+
"\n",
291+
"Task Tracker Menu: \n",
292+
"\n",
293+
"1. Add Task\n",
294+
"\n",
295+
"2. Display All Taks\n",
296+
"\n",
297+
"3. Delete Task\n",
298+
"\n",
299+
"4. Mark Task as Completed\n",
300+
"\n",
301+
"5. Update Task Priority\n",
302+
"\n",
303+
"6. Exit \n",
304+
"\n",
305+
"\n",
306+
"Enter your choice (1-6) : 2\n",
307+
"\n",
308+
"Task Tracker\n",
309+
"\n",
310+
"\n",
311+
"\n",
312+
"Task Name Due Date Priority Status \n",
313+
"Complete project 12/12/2023 Medium Pending \n",
314+
"Prepare Presentation 12/12/2023 Medium Pending \n",
315+
"Give Final exam 12/06/2023 High Completed \n",
316+
"\n",
317+
"\n",
318+
"\n",
319+
"*********Welcome to Task Tracker**********\n",
320+
"\n",
321+
"\n",
322+
"Task Tracker Menu: \n",
323+
"\n",
324+
"1. Add Task\n",
325+
"\n",
326+
"2. Display All Taks\n",
327+
"\n",
328+
"3. Delete Task\n",
329+
"\n",
330+
"4. Mark Task as Completed\n",
331+
"\n",
332+
"5. Update Task Priority\n",
333+
"\n",
334+
"6. Exit \n",
335+
"\n",
336+
"\n",
337+
"Enter your choice (1-6) : 5\n",
338+
"\n",
339+
"Enter task name to update priority : Complete project\n",
340+
"\n",
341+
"Enter new priority(High / Low / Medium) : High\n",
342+
"Priority of task 'Complete project' updated to High.\n",
343+
"*********Welcome to Task Tracker**********\n",
344+
"\n",
345+
"\n",
346+
"Task Tracker Menu: \n",
347+
"\n",
348+
"1. Add Task\n",
349+
"\n",
350+
"2. Display All Taks\n",
351+
"\n",
352+
"3. Delete Task\n",
353+
"\n",
354+
"4. Mark Task as Completed\n",
355+
"\n",
356+
"5. Update Task Priority\n",
357+
"\n",
358+
"6. Exit \n",
359+
"\n",
360+
"\n",
361+
"Enter your choice (1-6) : 2\n",
362+
"\n",
363+
"Task Tracker\n",
364+
"\n",
365+
"\n",
366+
"\n",
367+
"Task Name Due Date Priority Status \n",
368+
"Complete project 12/12/2023 High Pending \n",
369+
"Prepare Presentation 12/12/2023 Medium Pending \n",
370+
"Give Final exam 12/06/2023 High Completed \n",
371+
"\n",
372+
"\n",
373+
"\n",
374+
"*********Welcome to Task Tracker**********\n",
375+
"\n",
376+
"\n",
377+
"Task Tracker Menu: \n",
378+
"\n",
379+
"1. Add Task\n",
380+
"\n",
381+
"2. Display All Taks\n",
382+
"\n",
383+
"3. Delete Task\n",
384+
"\n",
385+
"4. Mark Task as Completed\n",
386+
"\n",
387+
"5. Update Task Priority\n",
388+
"\n",
389+
"6. Exit \n",
390+
"\n",
391+
"\n",
392+
"Enter your choice (1-6) : 7\n",
393+
"\n",
394+
"Please enter a correct option between 1-6\n",
395+
"*********Welcome to Task Tracker**********\n",
396+
"\n",
397+
"\n",
398+
"Task Tracker Menu: \n",
399+
"\n",
400+
"1. Add Task\n",
401+
"\n",
402+
"2. Display All Taks\n",
403+
"\n",
404+
"3. Delete Task\n",
405+
"\n",
406+
"4. Mark Task as Completed\n",
407+
"\n",
408+
"5. Update Task Priority\n",
409+
"\n",
410+
"6. Exit \n",
411+
"\n",
412+
"\n",
413+
"Enter your choice (1-6) : 6\n",
414+
"\n",
415+
"Exiting the Task Tacker. Have a Good Day!!!\n"
416+
]
417+
}
418+
],
419+
"source": [
420+
"# Part II - Short Project Python Response - 70 Points\n",
421+
"# Write a short program:\n",
422+
"# Develop a Task Tracker program in Python. Consider the following specifications:\n",
423+
"# •\tUse lists or tuples to store tasks with attributes like task name, due date, and priority level.\n",
424+
"# •\tImplement functions to add new tasks, display all tasks, and delete a task based on user input.\n",
425+
"# •\tAllow users to mark tasks as completed, and update the priority level of tasks.\n",
426+
"# •\tDisplay the tasks in a tabular format.\n",
427+
"\n",
428+
"\n",
429+
"\n",
430+
"# this funtion is used to add new task in th e tasks list with the help of append() function\n",
431+
"def add_task(tasks, name, due_date, priority, status = False):\n",
432+
" tasks.append({\"name\" : name, \"due_date\" : due_date, \"priority\" : priority, \"status\" :status})\n",
433+
"\n",
434+
"\n",
435+
"# this funtion is used to display all the tasks present in the tasks list\n",
436+
"def display_task(tasks):\n",
437+
" if not tasks: # used to check if the tasks list is empty\n",
438+
" print(\"\\n\\nNo tasks to display\")\n",
439+
" else:\n",
440+
" print(\"\\nTask Tracker\")\n",
441+
" print(\"\\n\\n\")\n",
442+
" print(\"{:<30} {:<25} {:<15} {:<10}\".format(\"Task Name\", \"Due Date\", \"Priority\", \"Status\"))\n",
443+
" # if conndition is used to assign status to \"completed\" or \"pending\"\n",
444+
" for task in tasks:\n",
445+
" print(\"{:<30} {:<25} {:<15} {:<10}\".format(task[\"name\"], task[\"due_date\"], task[\"priority\"], \"Completed\" if task[\"status\"] else \"Pending\"))\n",
446+
" print(\"\\n\\n\")\n",
447+
"\n",
448+
"\n",
449+
"#this function is used to delete the tasks from the task list by taking task name as input and uses remove() to remove the task entry\n",
450+
"def delete_task(tasks, task_name):\n",
451+
" for task in tasks:\n",
452+
" if task[\"name\"].lower() == task_name.lower():\n",
453+
" tasks.remove(task)\n",
454+
" print(f\"Task '{task_name}' deleted.\")\n",
455+
" return\n",
456+
" print(f\"Task '{task_name}' not found.\")\n",
457+
"\n",
458+
" print(\"\\n\\n\")\n",
459+
"\n",
460+
"#this funtion is used to mark the status as completed for a task\n",
461+
"def task_status(tasks, task_name):\n",
462+
" for task in tasks:\n",
463+
" if task[\"name\"].lower() == task_name.lower():\n",
464+
" # if condition is used to change the status value from False to True\n",
465+
" task[\"status\"] = True\n",
466+
" print(f\"Task '{task_name}' marked as completed.\")\n",
467+
" return\n",
468+
" print(f\"Task '{task_name}' not found.\")\n",
469+
" print(\"\\n\\n\")\n",
470+
"\n",
471+
"\n",
472+
"# this funtion is used to update the priority of the tasks from the tasks list\n",
473+
"def update_prority(tasks, task_name, new_priority):\n",
474+
" for task in tasks:\n",
475+
" if task[\"name\"].lower() == task_name.lower():\n",
476+
" # if condition is used to replace the old value with new value\n",
477+
" task[\"priority\"] = new_priority\n",
478+
" print(f\"Priority of task '{task_name}' updated to {new_priority}.\")\n",
479+
" return\n",
480+
" print(f\"Task '{task_name}' not found.\")\n",
481+
" print(\"\\n\\n\")\n",
482+
"\n",
483+
"def main():\n",
484+
"\n",
485+
" # intialize tasks list with empty list\n",
486+
" tasks = []\n",
487+
"\n",
488+
" # while is used to iterate the option menu for user if they want to perform more than 1 operation\n",
489+
" while True:\n",
490+
"\n",
491+
" #create a menu for Task Tracker\n",
492+
" print(\"*********Welcome to Task Tracker**********\")\n",
493+
" print(\"\\n\\nTask Tracker Menu: \")\n",
494+
" print(\"\\n1. Add Task\")\n",
495+
" print(\"\\n2. Display All Taks\")\n",
496+
" print(\"\\n3. Delete Task\")\n",
497+
" print(\"\\n4. Mark Task as Completed\")\n",
498+
" print(\"\\n5. Update Task Priority\")\n",
499+
" print(\"\\n6. Exit \")\n",
500+
"\n",
501+
" #take choice as input from user to perform the operation from the menu\n",
502+
" choice = input(\"\\n\\nEnter your choice (1-6) : \")\n",
503+
"\n",
504+
" #this choice is used to add a new Task in the Task Tracker\n",
505+
" if choice == '1':\n",
506+
" name = input(\"\\nEnter Task Name : \")\n",
507+
" due_date = input(\"\\nEnter Task Due Date (MM/DD/YYYY): \")\n",
508+
" priority = input(\"\\nEnter Task Priority(High / Low / Medium) : \")\n",
509+
" add_task(tasks, name, due_date, priority) # to call add_task function\n",
510+
"\n",
511+
" #this choice is used to display the Tasks in the Task Tracker\n",
512+
" elif choice == '2':\n",
513+
" display_task(tasks) # to call display_task function\n",
514+
"\n",
515+
" #this choice is used to delete a Task in the Task Tracker\n",
516+
" elif choice == '3':\n",
517+
" task_name = input(\"\\nEnter Task Name : \")\n",
518+
" delete_task(tasks, task_name) # to call delete_task function\n",
519+
"\n",
520+
" #this choice is used to update the Task to completed from pending in the Task Tracker\n",
521+
" elif choice == '4':\n",
522+
" task_name = input(\"Enter task name to mark as completed : \")\n",
523+
" task_status(tasks, task_name) # to call task_status function\n",
524+
"\n",
525+
"\n",
526+
" #this choice is used to update a prority(High / Low / Medium) for Task in the Task Tracker\n",
527+
" elif choice == '5':\n",
528+
" task_name = input(\"\\nEnter task name to update priority : \")\n",
529+
" new_priority = input(\"\\nEnter new priority(High / Low / Medium) : \")\n",
530+
" update_prority(tasks, task_name, new_priority) # to call update_prority function\n",
531+
"\n",
532+
" #this choice is used to exit the Task Tracker\n",
533+
" elif choice == '6':\n",
534+
" print(\"\\nExiting the Task Tacker. Have a Good Day!!!\")\n",
535+
" break\n",
536+
"\n",
537+
" #this is a default choice used to promt the user to enter correct value from the Task Tracker menu\n",
538+
" else:\n",
539+
" print(\"\\nPlease enter a correct option between 1-6\")\n",
540+
"\n",
541+
"\n",
542+
"\n",
543+
"\n",
544+
"\n",
545+
"# to call main function\n",
546+
"main()\n"
547+
]
548+
}
549+
]
550+
}

0 commit comments

Comments
 (0)
Please sign in to comment.