Mar-07-2024, 12:30 PM
Please forgive me in advance I am new and this has been doing my head in for ages, I just need to bash heads with someone to hopefully help any help would be much appreciated.
I have the following files:
tasks.txt file:
user.txt file:
I'm trying to create 2 .txt files:
task_overview.txt - contain total number of tasks generated, total number of tasks completed, total number of tasks uncompleted, total number of tasks not completed and overdue, percentage of tasks incomplete, percentage of tasks overdue.u
user_overview.txt - contain total number of users registered, total number of tasks generated, then for each user total number of tasks assigned to that user, percentage of total number of tasks assigned to that user, percentage tasks assigned to that user not completed, percentage tasks assigned to that user that must still be completed, percentage of tasks to that user that have not been completed and are overdue.
I have the below code that counts the total amount of tasks and then adds it to stat_dictionary, I'm guessing I need to do the same with the other stats and then print them out in a user friendly way in either task_overview.txt or user_overview.txt.
I have the following files:
tasks.txt file:
Output:sam;needs doing;now;2004-04-12;2024-03-05;No
sam;please do;gym;2024-05-20;2024-03-05;No
admin;do;sd;2004-12-12;2024-03-05;No
dam;dam;dam;2024-12-12;2024-03-05;No
This is read as - user task assigned to; What needs doing; description of task; Due date;
When task was added; is task complete.user.txt file:
Output:admin;password
sam;westlake
amy;sam
dam;dam
This is read as username:passwordI'm trying to create 2 .txt files:
task_overview.txt - contain total number of tasks generated, total number of tasks completed, total number of tasks uncompleted, total number of tasks not completed and overdue, percentage of tasks incomplete, percentage of tasks overdue.u
user_overview.txt - contain total number of users registered, total number of tasks generated, then for each user total number of tasks assigned to that user, percentage of total number of tasks assigned to that user, percentage tasks assigned to that user not completed, percentage tasks assigned to that user that must still be completed, percentage of tasks to that user that have not been completed and are overdue.
I have the below code that counts the total amount of tasks and then adds it to stat_dictionary, I'm guessing I need to do the same with the other stats and then print them out in a user friendly way in either task_overview.txt or user_overview.txt.
elif menu == 'gr': stat_dictionary = { "Total": 0, "Incomplete": 0, "Overdue": 0, "Percentage Incomplete": 0, "Percentage Overdue": 0 } task_list = open("tasks.txt", "r") for count, line in enumerate(task_list): pass stat_dictionary["Total"] += count + 1 stat_dictionary["Incomplete"] print(stat_dictionary)What I am struggling with is specifically taking the part I need from the txt file (e.g. date) and then passing it through stat_dictionary and in to it relevant file