Question: Your program should do the following: Part 1 : Open the file tasks.txt . zip Download tasks.txt . zipin read mode and get the tasks
Your program should do the following:
Part : Open the file tasks.txtzip Download tasks.txtzipin read mode and get the tasks
Download the linked tasks.txtzip file above and unzip it The txt file contains the information about some tasks. Each line is for one task and it follows the format iddescription,project,date". You need to open the file in the read mode, process each line as we did before, and store the information.
Note:
Your program does not need to ask the user for the filename. You may hardcode the filename in the program. But of course, you are not supposed to hardcode the data in the file.
It's best to decide what datatype you want to use to store one task list dictionary, or class and what datatype to use to store all tasks list or dictionary This will make the next part easier to work with.
Don't forget to unzip the txt file and put it in the folder as your Python program.
Part : Ask the user for the operation
Your program should support the following operations:
view all tasks
view tasks by date
view tasks by project
add a task
save tasks and quit
Your program needs to ask the user which operation they'd like to perform. If they enter an invalid operation, then your program should ask again. If they enter a valid operation, then your program should perform the operation Part and ask again until they choose the "quit" operation.
Note:
For simplicity, you can ask the user to enter numbers for the corresponding operation instead of actually type the operation description.
This part will end up being a very big while loop.
Don't write the code for the actual operation yet. That's for part You can simply print the task name for now. Test your code and make sure this part is working before moving on
Part : Perform the selected operation
Check Monday lecture recording to be uploaded for running examples
The first three operationsview all tasks, view tasks by date, and view tasks by projectare easier to work with. Remember to print the tasks nicely for readability. The fourth operationadd a taskwould depend on what datatype you used in Part to store each task and to store all the tasks.
Operation : view all tasks
If the user selects this operation, your program should print all of the tasks nicely.
Operation : view tasks by date
If the user selects this operation, your program should ask the user for the date they want to see and then print the tasks due that date nicely. You may choose the format of the user input for the date. A simple string eg is sufficient and you can compare it directly with the date information of each tasks.
Operation : view tasks by project
If the user selects this operation, your program should ask the user for the project they want to see and then print the tasks of the chosen project nicely.
Operation : add a task
If the user selects this operation, your program should ask the user for the details of the task: the ID the description, the due date, and the project it belongs to then add the task to all the tasks. By now, you should have a variable called tasks or alltasks from Part that stores all the tasks.
The IDs of the tasks should be unique. So when testing your program, make sure to add a tasks with an ID that hasn't been used yet. For simplicity, your program does NOT need to generate a unique ID automatically.
And no need to check if the date the user enters is valid.
Operation : save tasks and quit
If the user selects this operation, your program should write all the tasks to a file called newtasks.txt then say goodbye and terminate.
If the user didn't add any new tasks, the content of newtasks.txt is the same as tasks.txt If the user added task, newtasks.txt should contain the information about the added tasks in the iddescription,project,date" form as well.
Note:
The user should be able to choose any of the operations in any order and for as many times as they want. And if the user adds a task Operation and then views all tasks Operation your program should print all of the tasks, including the added ones.
Requirements
Your code should be well organized using functions, ie
Everything should be inside some function. No global variables.
Define at least three functions other than the main function. So there should be at least four functions in your program.
Do not import any module except for csv We didn't learn about the csv module in class. It is not necessary for the project and it doesn't make the coding much easier. It just eliminates the splitbycomma process.
All the outputs from your program should be printed nicely and readable.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
