-
Notifications
You must be signed in to change notification settings - Fork 25
Formative feedback #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
python/todo.py
Outdated
| Return - nothing | ||
| """ | ||
|
|
||
| with open(TASK_FILE, "a") as f: #append ensures text is always inserted at the end of the file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good; comment should probably be more a # Note: append to add task to end of list
| f.write(task + "\n") | ||
|
|
||
| def list_tasks(): | ||
| """Function: list_tasks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try not to change two things in one commit. You've edited the add_task and list_tasks on same commit, which makes it harder to unwind
python/todo.py
Outdated
| return "" | ||
|
|
||
| with open(TASK_FILE, "r") as f: | ||
| with open(TASK_FILE, "r") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid adding whitespace in a commit. Use git diff to see what is being changed
python/todo.py
Outdated
| read = f.readlines() | ||
|
|
||
| return "".join(f"{i+1}. {task}" for i, task in enumerate(read)) #combines and numbers tasks | ||
| return "\n".join(f"{i+1}. {task.strip()}" for i, task in enumerate(read)).strip() #combines and numbers tasks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rstrip is probably the better function here as you only want whitespac stripping from right
| with open(TASK_FILE, "a") as f: #text is inserted at the end of the file | ||
|
|
||
| with open(TASK_FILE, "a") as f: | ||
| #insert text at the end of the file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent comment to match code
| """ | ||
|
|
||
| with open(TASK_FILE, "a") as f: | ||
| with open(TASK_FILE, "a", encoding="utf-8") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As previous; try and group commits into logical units so unwinding them is easier, i.e. do all the comment lint tasks, then the encoding, then the imports, etc, etc
|
@TobyD785 Really nice work. Feedback above |
Excellent work! All tests pass cleanly. Code is well written and clear.
Things done well:
To improve