Skip to content

London | 26-ITP-May | Russom Gebremeskel | Sprint 2 | Coursework/sprint 2#1458

Open
russom-g wants to merge 15 commits into
CodeYourFuture:mainfrom
russom-g:coursework/sprint-2
Open

London | 26-ITP-May | Russom Gebremeskel | Sprint 2 | Coursework/sprint 2#1458
russom-g wants to merge 15 commits into
CodeYourFuture:mainfrom
russom-g:coursework/sprint-2

Conversation

@russom-g

@russom-g russom-g commented Jul 4, 2026

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I manage to predict, find, interpret and fix the errors in programs. I debugged each files and corrected the programs. I implemented functions based on requirements. I interpreted programs using documentations.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@russom-g russom-g added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 4, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 4, 2026
@russom-g russom-g added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 4, 2026
@Liam310 Liam310 added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 6, 2026
Comment on lines +38 to +39
// The return value of pad when it is called for the first time is 00. this is because the value of num is 0 and the pad function adds a 0 to the front of the string until the num characters has at least 2 characters.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be precise, what exactly is the return value of pad? I think you know what it is, but 00 doesn't quite exactly describe it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Liam. Thanks for reviewing my code.
The exact return value is 0 . It ads a single 0 instead of two 0s.

Comment on lines +47 to +48

// The return value of pad when it is called for the last time is 01. This is because the pad function adds a 0 to the front of the string if the characters of the string are less than 2. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above comment!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again it will be a single 0.

@@ -1,3 +1,3 @@
// Predict and explain first...
// =============> write your prediction here

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no benefit in adding a prediction now after you have run the code, but in future make sure you are always reading instructions thoroughly and completing the task as it is described.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood.

// The error occurred because decimalNumber is declared twice. No need to create the percentage variable too.
// Instead the expression is returned directly without declaring a new variable.
// The function should be called with a value passed in as an argument and the result should be stored in a variable to be logged to the console.
// convertedPercentage is declared to store the result of the function call and then logged to the console.

@Liam310 Liam310 Jul 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great explanation of the errors, just bear in mind that the sentence:

No need to create the percentage variable too

is a matter of opinion! No need to comment on the cleanliness of the code here 🙂

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good point. I will bear that in the mind when commenting on a code next time :)

//The sum of 10 and 32 is undefined

// The above error message is displayed when tested with node.
// The cause of the error message is the semicolon that is placed after the return statement.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this actually cause an error message to be displayed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It returns '' The sum of 10 and 32 is undefined". Initially I had assumed that this was happening because of the semicolon after return. Now I run the code again this time without the semicolon still get "undefined" message. I did some research online and it is actually not just because of the semicolon but because both the return statement and the expression "a+b" are not on the same line.

// 1) The above output (3) is displayed because the variable num is declared as a constant
// 2) .slice(-1) is used to get the last digit of num inside the function.
// 3) The function does not take any parameters so when it is called with an arguments it always returns the last digit of the constant num 103.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be different if the variable was declared with let?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I realise that the error is actually not because it declared as const. num isn't defined as the function's parameter so the function can take arguments later on when it's called.

// Try and describe the purpose / rationale behind each step

// To begin, we can start with
// 1. const penceString = "399p": initialises a string variable with the value "399p"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments are a hangover from the task in Sprint 1 (as are lots of the comments you have in the body of the function) - when copying code (and this goes for any time you do it!) make sure you are only bringing over the relevant stuff, and anything that isn't relevant should be excluded

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Noted.

Comment on lines +39 to +72
const currentOutput4 = formatAs12HourClock("12:00");
const targetOutput4 = "12:00 pm";
console.assert(
currentOutput4 === targetOutput4,
`current output: ${currentOutput4}, target output: ${targetOutput4}`
);

const currentOutput5 = formatAs12HourClock("00:01");
const targetOutput5 = "12:01 am";
console.assert(
currentOutput5 === targetOutput5,
`current output: ${currentOutput5}, target output: ${targetOutput5}`
);

const currentOutput6 = formatAs12HourClock("12:01");
const targetOutput6 = "12:01 pm";
console.assert(
currentOutput6 === targetOutput6,
`current output: ${currentOutput6}, target output: ${targetOutput6}`
);

const currentOutput7 = formatAs12HourClock("23:59");
const targetOutput7 = "11:59 pm";
console.assert(
currentOutput7 === targetOutput7,
`current output: ${currentOutput7}, target output: ${targetOutput7}`
);

const currentOutput8 = formatAs12HourClock("13:00");
const targetOutput8 = "01:00 pm";
console.assert(
currentOutput8 === targetOutput8,
`current output: ${currentOutput8}, target output: ${targetOutput8}`
);

@Liam310 Liam310 Jul 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a lot of good tests! Unfortunately, as it stands they don't run - they appear to be nested within the function that is being tested.

You should fix this, make sure your tests are running, see which ones fail (and some of them do fail!) then fix accordingly.

Hint: if you want to check that your tests are running, you can add a temporary test that you know will fail/edit one of your existing tests to make sure it fails. If you don't see any output, then you know the tests aren't running.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been stuck with this one an I am trying to figure out ways to fix the issue including asking for help from fellow trainees on slack. I will get back to you with the solution as soon as I figure it out. Thanks

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have fixed the issues with is code now. I removed the curly bracket at the end of the code. I also have fixed the issue with the function and the failing test cases. I commented on the new code lines in the program. Thanks for your time and feedbacks again.

@Liam310 Liam310 removed the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jul 6, 2026
@Liam310 Liam310 added the Reviewed Volunteer to add when completing a review with trainee action still to take. label Jul 6, 2026
russom added 2 commits July 7, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants