Skip to content

Commit e36b0af

Browse files
committed
master - edited doc strings
1 parent d58b839 commit e36b0af

File tree

5 files changed

+97
-67
lines changed

5 files changed

+97
-67
lines changed

C++ Version/main.cpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
// Todo: Alter the complete_tasks method so that it only calls 'complete' on
2-
// non-completed task.
3-
// Add a remove_task method that removes only one task by id
4-
//
5-
// Upon calling Complete() on a task, set _value of that task object to the number of occurrences of the
6-
// string "CCN" (case in-sensitive) that appears in the task's name.
7-
//
8-
// Fix the Task object id, so that it is unique for each new task.
9-
// Fix other bugs.
10-
11-
// Note: - You cannot edit/change the TaskManager class directly. Think of it as a 3rd party library
12-
// - You can create new objects, etc
1+
/* Todo:
2+
- Alter the complete_tasks method so that it only calls 'complete' on
3+
non-completed task.
4+
- Add a remove_task method that removes only one task by id
5+
6+
- Upon calling complete() on a task, set _value of that task object to the number of occurrences of the
7+
string "CCN" (case in-sensitive) that appears in the task's name.
8+
9+
- Fix the Task object id, so that it is unique for each new task. (please consider scalability and
10+
what else the Id could be used for)
11+
12+
- Fix other bugs and make improvements where you see fit
13+
- Add error handling where you see fit
14+
15+
Note:
16+
- You cannot edit/change the TaskManager class directly. Think of it as a 3rd party library
17+
- You can create new objects, etc
18+
*/
1319

1420
#include <limits>
1521

C++ Version/task.h

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
// Todo: Alter the complete_tasks method so that it only calls 'complete' on
2-
// non-completed task.
3-
// Add a remove_task method that removes only one task by id
4-
//
5-
// Upon calling Complete() on a task, set _value of that task object to the number of occurrences of the
6-
// string "CCN" (case in-sensitive) that appears in the task's name.
7-
//
8-
// Fix the Task object id, so that it is unique for each new task.
9-
// Fix other bugs.
10-
11-
// Note: - You cannot edit/change the TaskManager class directly. Think of it as a 3rd party library
12-
// - You can create new objects, etc
1+
/* Todo:
2+
- Alter the complete_tasks method so that it only calls 'complete' on
3+
non-completed task.
4+
- Add a remove_task method that removes only one task by id
5+
6+
- Upon calling complete() on a task, set _value of that task object to the number of occurrences of the
7+
string "CCN" (case in-sensitive) that appears in the task's name.
8+
9+
- Fix the Task object id, so that it is unique for each new task. (please consider scalability and
10+
what else the Id could be used for)
11+
12+
- Fix other bugs and make improvements where you see fit
13+
- Add error handling where you see fit
14+
15+
Note:
16+
- You cannot edit/change the TaskManager class directly. Think of it as a 3rd party library
17+
- You can create new objects, etc
18+
*/
1319

1420
#ifndef __Task__
1521
#define __Task__

C++ Version/task_manager.h

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
// Todo: Alter the complete_tasks method so that it only calls 'complete' on
2-
// non-completed task.
3-
// Add a remove_task method that removes only one task by id
4-
//
5-
// Upon calling Complete() on a task, set _value of that task object to the number of occurrences of the
6-
// string "CCN" (case in-sensitive) that appears in the task's name.
7-
//
8-
// Fix the Task object id, so that it is unique for each new task.
9-
// Fix other bugs.
10-
11-
// Note: - You cannot edit/change the TaskManager class directly. Think of it as a 3rd party library
12-
// - You can create new objects, etc
1+
/* Todo:
2+
- Alter the complete_tasks method so that it only calls 'complete' on
3+
non-completed task.
4+
- Add a remove_task method that removes only one task by id
5+
6+
- Upon calling complete() on a task, set _value of that task object to the number of occurrences of the
7+
string "CCN" (case in-sensitive) that appears in the task's name.
8+
9+
- Fix the Task object id, so that it is unique for each new task. (please consider scalability and
10+
what else the Id could be used for)
11+
12+
- Fix other bugs and make improvements where you see fit
13+
- Add error handling where you see fit
14+
15+
Note:
16+
- You cannot edit/change the TaskManager class directly. Think of it as a 3rd party library
17+
- You can create new objects, etc
18+
*/
1319

1420
#ifndef __TaskManager__
1521
#define __TaskManager__

Python Version/main.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
# Todo: Alter the complete_tasks method so that it only calls 'complete' on
2-
# non-completed task.
3-
# Add a remove_task method that removes only one task by id
4-
#
5-
# Upon calling complete() on a task, set _value of that task object to the number of occurrences of the
6-
# string "CCN" (case in-sensitive) that appears in the task's name.
7-
#
8-
# Fix the Task object id, so that it is unique for each new task.
9-
# Fix other bugs.
10-
11-
# Note: - You cannot edit/change the TaskManager class directly. Think of it as a 3rd party library
12-
# - You can create new objects, etc
1+
""" Todo:
2+
- Alter the complete_tasks method so that it only calls 'complete' on
3+
non-completed task.
4+
- Add a remove_task method that removes only one task by id
5+
6+
- Upon calling complete() on a task, set _value of that task object to the number of occurrences of the
7+
string "CCN" (case in-sensitive) that appears in the task's name.
8+
9+
- Fix the Task object id, so that it is unique for each new task. (please consider scalability and
10+
what else the Id could be used for)
11+
12+
- Fix other bugs and make improvements where you see fit
13+
- Add error handling where you see fit
14+
15+
Note:
16+
- You cannot edit/change the TaskManager class directly. Think of it as a 3rd party library
17+
- You can create new objects, etc
18+
"""
1319

1420
from task_manager import Task, TaskManager
1521

Python Version/task_manager.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
# Todo: Alter the complete_tasks method so that it only calls 'complete' on
2-
# non-completed task.
3-
# Add a remove_task method that removes only one task by id
4-
#
5-
# Upon calling complete() on a task, set _value of that task object to the number of occurrences of the
6-
# string "CCN" (case in-sensitive) that appears in the task's name.
7-
#
8-
# Fix the Task object id, so that it is unique for each new task.
9-
# Fix other bugs.
1+
""" Todo:
2+
- Alter the complete_tasks method so that it only calls 'complete' on
3+
non-completed task.
4+
- Add a remove_task method that removes only one task by id
105
11-
# Note: - You cannot edit/change the TaskManager class directly. Think of it as a 3rd party library
12-
# - You can create new objects, etc
6+
- Upon calling complete() on a task, set _value of that task object to the number of occurrences of the
7+
string "CCN" (case in-sensitive) that appears in the task's name.
8+
9+
- Fix the Task object id, so that it is unique for each new task. (please consider scalability and
10+
what else the Id could be used for)
11+
12+
- Fix other bugs and make improvements where you see fit
13+
- Add error handling where you see fit
14+
15+
Note:
16+
- You cannot edit/change the TaskManager class directly. Think of it as a 3rd party library
17+
- You can create new objects, etc
18+
"""
1319

1420

1521
class Task(object):
@@ -33,7 +39,7 @@ def name(self):
3339

3440
@property
3541
def id(self):
36-
return self._id
42+
self._id
3743

3844
@property
3945
def value(self):
@@ -44,18 +50,18 @@ def value(self):
4450
class TaskManager(object):
4551

4652
def __init__(self):
47-
self.tasks = []
53+
self._tasks = []
4854

4955
def import_task(self, task):
50-
self.tasks.append(task)
56+
self._tasks.append(task)
5157

5258
def complete_tasks(self):
53-
if len(self.tasks) > 0:
54-
if not all([task.is_completed for task in self.tasks]):
55-
for task in self.tasks:
59+
if len(self._tasks) > 0:
60+
if not all([task.is_completed for task in self._tasks]):
61+
for task in self._tasks:
5662
task.complete()
5763
print('task {name} completed'.format(name=task.name))
5864

5965
def remove_tasks(self):
60-
while len(self.tasks) > 0:
61-
self.tasks.pop()
66+
while len(self._tasks) > 0:
67+
self._tasks.pop()

0 commit comments

Comments
 (0)