Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Define a class TaskCalculator ( ) to keep track of how much time a day's tasks will likely take. The class has a single
Define a class TaskCalculator ( ) to keep track of how much time a day's tasks will likely take. The class has a single attribute, daily tasks, which is created as an empty dictionary using the classes' initializer function It will then have two methods: add_task and calculate_time. add_task (task, duration) : input parameters task (a string) duration (an int or float describing the number of hours) this method will add an entry to the daily tasks dictionary, using task as the key and duration as the value calculate_time(): no input parameters the code will then determine, given the values in the instance attribute daily_tasks, how long the daily_tasks are estimated to take by summing up the dictionary values the number of hours estimated should be returned from this method if no tasks are stored then the return value should be 0 Activate Mi
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To define the TaskCalculator class as per the given requirements you can use the following code pyth...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started