West Midlands | ITP-Sep-2025 | Ahmad Ehsas | Sprint 2 | Structuring and Testing Data#734
West Midlands | ITP-Sep-2025 | Ahmad Ehsas | Sprint 2 | Structuring and Testing Data#734ahmadehsas wants to merge 13 commits intoCodeYourFuture:mainfrom
Conversation
…e error. and finally, rewrote the code to fix the problem.
…n incorrectly. i explained the error and rewrote the code as a comment.
…ssue and fixed the code.
…hen explained it in comment how to calculate the BMI.
…on many times for different inputs.
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
1 similar comment
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
3 similar comments
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
1 similar comment
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
Sprint-2/1-key-errors/1.js
Outdated
| @@ -14,7 +14,12 @@ function convertToPercentage(decimalNumber) { | |||
|
|
|||
| console.log(decimalNumber); | |||
There was a problem hiding this comment.
Do you think console.log() is calling an undeclared variable decimalNumber instead of the function convertToPercentage(0.5)? You have corrected the function on line 25.
There was a problem hiding this comment.
I fixed the issue, and as a comment, the code is now fixed.
| console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
|
|
||
| // =============> write your explanation here | ||
| // =============> write your explanation here: in the code above, the function Sum is not returning because the return function is not defined and it is written incorrectly. The return function should be written before the a + b values.// |
There was a problem hiding this comment.
We could say the statement a+b is unreachable because there is an empty return statement before it.
You have fixed the code correctly.
|
|
||
| // a) When formatTimeDisplay is called how many times will pad be called? | ||
| // =============> write your answer here | ||
| // =============> write your answer here: When formatTimeDisplay is called four times pad will be called, one for remainingSeconds, one for remainingMinutes, one for totalMinutes and one for totalHours. |
There was a problem hiding this comment.
The function pad(num) is called inside the formatTimeDisplay function. And if we look inside, how many times do we see the function name pad? we do see there are 3 different arguments being called by each.
There was a problem hiding this comment.
Do you want to update the answer on line 20? We only see 3 times the pad is called?
|
|
||
| // b) What is the value assigned to num when pad is called for the first time? | ||
| // =============> write your answer here | ||
| // =============> write your answer here: When pad is called for thee first time, num will be assigned the value of 1, which is the value of remainingSeconds. |
There was a problem hiding this comment.
can you spot where the function pad is called first? which argument does it have?
There was a problem hiding this comment.
The function pad first called is: pad(totalHours)
The argument it receives is the value of totalHours.
There was a problem hiding this comment.
If pad is called first for totalHours, do you want to update your answer on line 25 which is the value of totalhours?
|
|
||
| // c) What is the return value of pad is called for the first time? | ||
| // =============> write your answer here | ||
| // =============> write your answer here: The return value of pad when called for the first time will be `01` because it pads the number 1 with a leading zero to make it two digits. |
There was a problem hiding this comment.
when you find out when the function pad is called first from above, we can figure out return value here.
There was a problem hiding this comment.
if totalhours is called with pad the first, we see that it can't be 01 hour as the input is only 61 seconds. Do you want to update line 28?
There was a problem hiding this comment.
When the input is 61 seconds, the 'totalHours' is 00 because 61 seconds is not changeable to hours.
|
|
||
| // d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer | ||
| // =============> write your answer here | ||
| // =============> write your answer here: When pad is called for the last time, num will be assigned the value of 0, which is the value of totalHours. |
There was a problem hiding this comment.
Like above, we can find out when a function is called first based on the order in which it is called in the series. In other words, which appears first in the series.
There was a problem hiding this comment.
you have mentioned in the reply, pad(toalhours) is called first, that means your answer on line 31 changes, right? do you want update it?
|
|
||
| // e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer | ||
| // =============> write your answer here | ||
| // =============> write your answer here: when pad is called for the last time, the return value will be `0` because it pads the number 0 with a leading zero to make it two digits. |
There was a problem hiding this comment.
This will also change when we know the above.
There was a problem hiding this comment.
Simiarly pad function is called first for totalHours, this answer on line 34 changes as well. Do you want to update it?
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
1 similar comment
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
3 similar comments
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
1 similar comment
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
1 similar comment
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
1 similar comment
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
Self checklist
Changelist
I have completed all the required tasks.
Questions