London|May_2025|Fatma_Degirmenci|Structuring_and_Testing_Data|Sprint1#508
London|May_2025|Fatma_Degirmenci|Structuring_and_Testing_Data|Sprint1#508fatmaevin wants to merge 7 commits intoCodeYourFuture:mainfrom
Conversation
…ds like slice, random, and floor. Made updates to the code accordingly for the assignment.
cjyuan
left a comment
There was a problem hiding this comment.
-
Why not practice "committing files one by one, on purpose, and for a reason"?
In VSCode, you can select which file to stage, and commit only the staged file.
See: https://www.youtube.com/watch?v=z5jZ9lrSpqk&t=705 (At around 12:50 minute marker, the video shows how to stage a single file). -
When describing code, we should avoid simply translating it literally because:
- Other developers can already read the code and see what it does.
- A literal description adds no extra insight to help others understand the purpose, logic, or context of the code.
Here is an example of a literal translation of a piece of code:
// if num mod 2 is 0
if (num % 2 == 0)
...
A better description would be "if num is even".
Describing code can be quite challenging at first (even in your native language). I suggest using ChatGPT to explore alternative ways to describe the code. Along the way, you might also pick up some useful programming terminology.
| paddedPenceNumberString.length - 2 | ||
| ); - In this line, the substring method is used to extract only the first character from the previously created paddedPenceNumberString variable, | ||
| which has a length of 3. This extracted part is assigned to pounds. | ||
| 5- And finally, here we use the substring method to take the last two characters, and then use the padEnd method to add zeros at the end |
There was a problem hiding this comment.
Could we expect this program to work as intended for any valid penceString if we deleted .padEnd(2, "0") from the code?
In other words, do we really need .padEnd(2, "0") in this script?
cjyuan
left a comment
There was a problem hiding this comment.
Leaving responses directly in the comment threads makes tracking the discussion easier.
Here is a simplified version of best practices ChatGPT suggested for responding to inline comments in a pull request:
- ✅ Reply to every comment – Let the reviewer know you saw it.
- ✏️ Make the change if needed – Fix the code if the comment points out a real issue.
- 🤔 Explain if you don't agree – If you think the code is fine, politely explain why.
- ✅ Mark as resolved when done – Only mark comments resolved after you fix or respond.
- 💬 Keep replies short and polite – Be respectful and to the point.
- ⏱️ Respond soon – Don’t wait too long to reply.
- 🧪 Test your changes – Make sure your fixes actually work.
- 📍 Reply directly under the comment – This keeps the conversation easy to follow.
You can try the approach in future PRs.
| 5- And finally, here we use the substring method to take the last two characters, and then use the padEnd method to add zeros at the end if | ||
| the length is less than 2.padEnd(2, "0") ensures the pence part always has two digits.Without this, if the pence is a single digit (e.g., "5"), | ||
| it could be displayed incorrectly (e.g., "5" instead of "50"). |
There was a problem hiding this comment.
Have you tried executing the script without padEnd(2, "0") using different values of penceString to validate your expectation?
There was a problem hiding this comment.
Thanks for the feedback. I just tested the script with various penceString values without the .padEnd(2, "0") part.
It works correctly in all cases because .padStart(3, "0") already adds leading zeros when needed, ensuring the pence part always has two digits—I realized this just now.
So, .padEnd(2, "0") is actually unnecessary.
I will update the comment to reflect this and remove the misleading explanation.
|
Great job! |

Self checklist
Changelist