From c786fbc0e4273bce0ec9830950454b2746c114d9 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Thu, 19 Feb 2026 12:25:27 +0000 Subject: [PATCH 1/8] completion of 1-key-errors --- Sprint-2/1-key-errors/0.js | 17 ++++++++++++----- prep/Sprint1 Internship email.docx | Bin 0 -> 14615 bytes 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 prep/Sprint1 Internship email.docx diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 653d6f5a0..d28326b92 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -1,13 +1,20 @@ // Predict and explain first... // =============> write your prediction here - +// The code will throw an error because the variable 'str' is being redeclared inside the function 'capitalise'. The error message is likely to be a syntax error. // call the function capitalise with a string input // interpret the error message and figure out why an error is occurring -function capitalise(str) { - let str = `${str[0].toUpperCase()}${str.slice(1)}`; - return str; -} +//function capitalise(str) { + // let str = `${str[0].toUpperCase()}${str.slice(1)}`; + //return str; +//} // =============> write your explanation here +// The error is occurring because we are trying to declare a variable 'str' inside the function that has the same name as the parameter 'str'.To fix this problem, create an variable with a new name Newstr . So we would change the line to: Newstr = `${str[0].toUpperCase()}${str.slice(1)}`; // =============> write your new code here +function capitalise(str) { + let Newstr = `${str[0].toUpperCase()}${str.slice(1)}`; + return Newstr; +} +str="hello world"; +console.log(capitalise(str)); diff --git a/prep/Sprint1 Internship email.docx b/prep/Sprint1 Internship email.docx new file mode 100644 index 0000000000000000000000000000000000000000..ebfdbc70fe4a318d5c3c01971af24b289acde164 GIT binary patch literal 14615 zcmeHuWpEtJvgSy#m}OZE7FrAzgT>6u%*@Qvh?$w0nZaUaW+qFr*kW3p`|jBT_iSwJ z{(Y|_reeCPzU-Oq%*wAbvt-1+WKVzW=0swpl2LL_-pg`66t*smk ztsJx!Tx|^PHECQdEk5Ud042)?fWFWFpX0yr9jK2Vwd$cm61+=zM2u-t)ccWJN&y$rUWwx9Z^GX?6^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@( zgX~`l@TcY<_LIqo|5dC)ECcJK_8e z|KI7gzk~lys{a62QT-eIH;Vmt34dpOe@Kv_`L~3>aKOLg|4IS=Km!0kIso852*Kas ke_fdW45woF6a3%Hw2V0TyL$Y#w+a@}{mwafn14I_Uo?bRW&i*H literal 0 HcmV?d00001 From 2068031681be1d77c7b700ad916454257c7da803 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Thu, 19 Feb 2026 12:27:54 +0000 Subject: [PATCH 2/8] completion of 1-key-errors --- Sprint-2/1-key-errors/1.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Sprint-2/1-key-errors/1.js b/Sprint-2/1-key-errors/1.js index f2d56151f..4d2c4c156 100644 --- a/Sprint-2/1-key-errors/1.js +++ b/Sprint-2/1-key-errors/1.js @@ -2,19 +2,28 @@ // Why will an error occur when this program runs? // =============> write your prediction here +// The error will occur because we are trying to declare a variable with the same name as the parameter of the function. The error message will likely indicate that there is a syntax error or that the variable 'str' has already been declared. // Try playing computer with the example to work out what is going on -function convertToPercentage(decimalNumber) { - const decimalNumber = 0.5; - const percentage = `${decimalNumber * 100}%`; +//function convertToPercentage(decimalNumber) { + //const decimalNumber = 0.5; + //const percentage = `${decimalNumber * 100}%`; - return percentage; -} + //return percentage; +// } -console.log(decimalNumber); +//console.log(decimalNumber); // =============> write your explanation here +// The error is occurring because we are trying to declare a variable 'decimalNumber' inside the function that has the same name as the parameter 'decimalNumber'. To fix this problem, we can different variable name for the parameter or the variable inside the function. For example, we could change the line to: const decimalNum = 0.5; and then use 'decimalNum' instead of 'decimalNumber' in the rest of the function. // Finally, correct the code to fix the problem // =============> write your new code here + +function convertToPercentage(decimalNumber) { + const decimalNum = 0.5; + const percentage = `${decimalNum * 100}%`; + return percentage; +} +console.log(convertToPercentage(0.5)); From 8cfcf96f8fd4b98942783318edc21180ab6f41bf Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Thu, 19 Feb 2026 12:32:10 +0000 Subject: [PATCH 3/8] completion of 1-key-errors --- Sprint-2/1-key-errors/2.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index aad57f7cf..cbf845488 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -4,17 +4,21 @@ // this function should square any number but instead we're going to get an error // =============> write your prediction of the error here - -function square(3) { - return num * num; -} +// The error will occur because we are trying to declare a function with a parameter that is not a valid variable name. The parameter '3' is not a valid variable name in JavaScript, and this will likely result in a syntax error. +//function square(3) { + // return num * num; +//} // =============> write the error message here - +// SyntaxError: Unexpected number '3' // =============> explain this error message here - +// The error message is indicating that there is a syntax error in the code because we are trying to use a number '3' as a parameter name in the function declaration, which is not allowed in JavaScript. Parameter names must be valid identifiers, which cannot start with a number. To fix this error, we need to change the parameter name to a valid identifier, such as 'num' or 'x'. So we would change the line to: function square(num) { return num * num; } // Finally, correct the code to fix the problem // =============> write your new code here +function square(num) { + return num * num; +} +console.log(square(3)); From 87950af64434f13049106e43e59e5db823278eca Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Thu, 19 Feb 2026 12:38:26 +0000 Subject: [PATCH 4/8] completion of 1-key-errors --- Sprint-2/2-mandatory-debug/0.js | 15 +++++++++++---- Sprint-2/2-mandatory-debug/1.js | 20 ++++++++++++++------ Sprint-2/2-mandatory-debug/2.js | 28 +++++++++++++++++++++------- 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/0.js b/Sprint-2/2-mandatory-debug/0.js index b27511b41..143987ed5 100644 --- a/Sprint-2/2-mandatory-debug/0.js +++ b/Sprint-2/2-mandatory-debug/0.js @@ -1,14 +1,21 @@ // Predict and explain first... // =============> write your prediction here +// The error will occur because the function 'sum' is not returning the result of multiplying 'a' and 'b'. Instead, it is returning 'undefined' due to the function being incomplete. The error message will likely indicate that the result of the sum is 'undefined' when we try to log it to the console. -function multiply(a, b) { - console.log(a * b); -} +//function multiply(a, b) { + //console.log(a * b); +//} -console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); +//console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); // =============> write your explanation here +// The error is occurring because the function 'multiply' is not returning any value. In JavaScript, if a function does not explicitly return a value, it returns 'undefined' by default. To fix this problem, we need to add a return statement to the function that returns the result of multiplying 'a' and 'b'. For example, we could change the line to: return a * b; so that the function will return the correct result when called. // Finally, correct the code to fix the problem // =============> write your new code here +function multiply(a, b) { + return a * b; +} +console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); + diff --git a/Sprint-2/2-mandatory-debug/1.js b/Sprint-2/2-mandatory-debug/1.js index 37cedfbcf..a674f1df8 100644 --- a/Sprint-2/2-mandatory-debug/1.js +++ b/Sprint-2/2-mandatory-debug/1.js @@ -1,13 +1,21 @@ // Predict and explain first... // =============> write your prediction here +//The error will occur because the function 'sum' is not returning the result of summing 'a' and 'b'. Instead, it is returning 'undefined' due to the function being incomplete. The error message will likely indicate that the result of the sum is 'undefined' when we try to log it to the console. +//function sum(a, b) { + //return; + //a + b; +//} -function sum(a, b) { - return; - a + b; -} - -console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); +//console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); // =============> write your explanation here +// The error is occurring because the function 'sum' is not returning any value. In JavaScript, if a function does not explicitly return a value, it returns 'undefined' by default. To fix this problem, we need to add a return statement to the function that returns the result of summing 'a' and 'b'. For example, we could change the line to: return a + b; so that the function will return the correct result when called. + + // Finally, correct the code to fix the problem // =============> write your new code here +function sum(a, b) { + return a + b; +} + +console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index 57d3f5dc3..aa320c3f3 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -2,23 +2,37 @@ // Predict the output of the following code: // =============> Write your prediction here +//the output will be: an error because the function getLastDigit is not defined to take any parameters, but we are trying to pass a number as an argument when we call the function. The error message will likely indicate that getLastDigit is not a function or that it cannot be called with arguments. -const num = 103; +//const num = 103; -function getLastDigit() { - return num.toString().slice(-1); -} +//function getLastDigit() { + //return num.toString().slice(-1); +//} -console.log(`The last digit of 42 is ${getLastDigit(42)}`); -console.log(`The last digit of 105 is ${getLastDigit(105)}`); -console.log(`The last digit of 806 is ${getLastDigit(806)}`); +//console.log(`The last digit of 42 is ${getLastDigit(42)}`); +//console.log(`The last digit of 105 is ${getLastDigit(105)}`); +//console.log(`The last digit of 806 is ${getLastDigit(806)}`); // Now run the code and compare the output to your prediction // =============> write the output here +//it does run but returns the last digit of the number 103 for all three calls to getLastDigit, which is not the expected behavior. The output will be: +// The last digit of 42 is 3 +// The last digit of 105 is 3 +// The last digit of 806 is 3 + // Explain why the output is the way it is // =============> write your explanation here +// The function getLastDigit is not taking any parameters, so it always returns the last digit of the global variable 'num', which is 103. The function should take a number as a parameter and return the last digit of that number. + // Finally, correct the code to fix the problem // =============> write your new code here +function getLastDigit(num) { + return num.toString().slice(-1); +} +console.log(`The last digit of 42 is ${getLastDigit(42)}`); +console.log(`The last digit of 105 is ${getLastDigit(105)}`); +console.log(`The last digit of 806 is ${getLastDigit(806)}`); // This program should tell the user the last digit of each number. // Explain why getLastDigit is not working properly - correct the problem From 114ee523479215d9e43bbf1ebbda05710e9df33f Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Thu, 19 Feb 2026 12:42:04 +0000 Subject: [PATCH 5/8] completion of 3-mandatory-implement --- Sprint-2/3-mandatory-implement/1-bmi.js | 6 +++++- Sprint-2/3-mandatory-implement/2-cases.js | 9 +++++++++ Sprint-2/3-mandatory-implement/3-to-pounds.js | 20 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 17b1cbde1..56a8e1c85 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -16,4 +16,8 @@ function calculateBMI(weight, height) { // return the BMI of someone based off their weight and height -} \ No newline at end of file + const bmi = weight / (height ^2); + return Math.round(bmi * 10) / 10; +} +console.log(calculateBMI(70, 1.73)); // should return 23.4 + diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index 5b0ef77ad..a547b58bf 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -14,3 +14,12 @@ // You will need to come up with an appropriate name for the function // Use the MDN string documentation to help you find a solution // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase + +function toUpperSnakeCase(str) { + // return the string in UPPER_SNAKE_CASE + const upperStr = str.toUpperCase(); + const snakeCaseStr = upperStr.replace(/ /g, '_'); + return snakeCaseStr; +} +console.log(toUpperSnakeCase("hello there")); // should return "HELLO_THERE" +console.log(toUpperSnakeCase("lord of the rings")); // should return "LORD_OF_THE_RINGS" diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index 6265a1a70..7fdebcbaf 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -4,3 +4,23 @@ // You will need to declare a function called toPounds with an appropriately named parameter. // You should call this function a number of times to check it works for different inputs + +function toPounds(penceString) { +const penceStringWithoutTrailingP = penceString.substring( + 0, + penceString.length - 1 +); +const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); +const pounds = paddedPenceNumberString.substring( + 0, + paddedPenceNumberString.length - 2 +); +const pence = paddedPenceNumberString + .substring(paddedPenceNumberString.length - 2) + .padEnd(2, "0"); +return `£${pounds}.${pence}`; +} +console.log(toPounds("123p")); // should return "£1.23" +console.log(toPounds("5p")); // should return "£0.05" +console.log(toPounds("75p")); // should return "£0.75" +console.log(toPounds("1000p")); // should return "£10.00" From eab4d0d2ae51cf1c63d313519f2587108ba1f842 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Thu, 19 Feb 2026 12:44:55 +0000 Subject: [PATCH 6/8] completion of 4-mandatory-interpret --- Sprint-2/4-mandatory-interpret/time-format.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sprint-2/4-mandatory-interpret/time-format.js b/Sprint-2/4-mandatory-interpret/time-format.js index 7c98eb0e8..4a5fc99db 100644 --- a/Sprint-2/4-mandatory-interpret/time-format.js +++ b/Sprint-2/4-mandatory-interpret/time-format.js @@ -18,17 +18,22 @@ function formatTimeDisplay(seconds) { // a) When formatTimeDisplay is called how many times will pad be called? // =============> write your answer here +// The function pad will be called three times when formatTimeDisplay is called, once for each of; hours, minutes, and seconds.These are then passed as an argument to the pad function to ensure that they are displayed with two digits in the final output string. // Call formatTimeDisplay with an input of 61, now answer the following: // b) What is the value assigned to num when pad is called for the first time? // =============> write your answer here +// The value assigned to num when pad is called for the first time is the totalHours value, which is 0. The value of 61 seconds is only one minute and one second, any value that includes hours must be in excess of 3600 seconds. // c) What is the return value of pad is called for the first time? // =============> write your answer here +// The return value of pad when it is called for the first time is "00". This is because the totalHours value is 0, and when it is converted to a string and passed to the pad function, it will be padded with a leading zero to ensure that it has two digits, resulting in "00". // 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 +// The value assigned to num when pad is called for the last time in this program is the remainingSeconds value, which is 1. This is because the input of 61 seconds results in 1 second remaining after accounting for the full minute. // 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 +//This value displayed with two digits in the final output string, resulting in "01". From ad004aaa432e4ecbc2bf1ca1437f969cef76813f Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Fri, 20 Feb 2026 17:11:19 +0000 Subject: [PATCH 7/8] completion of new sprint2 --- .github/FUNDING.yml | 2 - .github/pull_request_template.md | 36 ------------------ .github/workflows/validate-pr-metadata.yml | 18 --------- .../Sprint1 Internship email.docx | Bin 4 files changed, 56 deletions(-) delete mode 100644 .github/FUNDING.yml delete mode 100644 .github/pull_request_template.md delete mode 100644 .github/workflows/validate-pr-metadata.yml rename {prep => Sprint-1}/Sprint1 Internship email.docx (100%) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index ea03447fe..000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -github: CodeYourFuture -custom: https://codeyourfuture.io/donate diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 0d8ee1dfd..000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,36 +0,0 @@ - - -## 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](https://curriculum.codeyourfuture.io/guides/reviewing/style-guide/) - -## Changelist - -Briefly explain your PR. - -## Questions - -Ask any questions you have for your reviewer. diff --git a/.github/workflows/validate-pr-metadata.yml b/.github/workflows/validate-pr-metadata.yml deleted file mode 100644 index 10ef3c74a..000000000 --- a/.github/workflows/validate-pr-metadata.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Validate PR Metadata -on: - pull_request_target: - types: - - labeled - - unlabeled - - opened - - edited - - reopened - -jobs: - validate_pr_metadata: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: CodeYourFuture/actions/validate-pr-metadata@main - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/prep/Sprint1 Internship email.docx b/Sprint-1/Sprint1 Internship email.docx similarity index 100% rename from prep/Sprint1 Internship email.docx rename to Sprint-1/Sprint1 Internship email.docx From 4a75c586140190a51b178fdae5a94c4b3bd8e39b Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Fri, 20 Feb 2026 17:30:31 +0000 Subject: [PATCH 8/8] completion of exercises for tests and implementation for sprint3 --- .../implement/1-get-angle-type.js | 25 ++++++++++++++++++- .../implement/2-is-proper-fraction.js | 19 ++++++++++++++ .../implement/3-get-card-value.js | 18 +++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js index 9e05a871e..27616acae 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -16,7 +16,20 @@ function getAngleType(angle) { // TODO: Implement this function -} + if (angle > 0 && angle < 90) { + return "Acute angle"; + } else if (angle === 90) { + return "Right angle"; + } else if (angle > 90 && angle < 180) { + return "Obtuse angle"; + } else if (angle === 180) { + return "Straight angle"; + } else if (angle > 180 && angle < 360) { + return "Reflex angle"; + } else { + return "Invalid angle"; + } +} // The line below allows us to load the getAngleType function into tests in other files. // This will be useful in the "rewrite tests with jest" step. @@ -35,3 +48,13 @@ function assertEquals(actualOutput, targetOutput) { // Example: Identify Right Angles const right = getAngleType(90); assertEquals(right, "Right angle"); +const acute = getAngleType(45); +assertEquals(acute, "Acute angle"); +const obtuse = getAngleType(120); +assertEquals(obtuse, "Obtuse angle"); +const straight = getAngleType(180); +assertEquals(straight, "Straight angle"); +const reflex = getAngleType(270); +assertEquals(reflex, "Reflex angle"); +const invalid = getAngleType(400); +assertEquals(invalid, "Invalid angle"); diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 970cb9b64..0769a29b0 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -11,7 +11,17 @@ // execute the code to ensure all tests pass. function isProperFraction(numerator, denominator) { + + // TODO: Implement this function + if (denominator === 0) { + return false; + } + if (Math.abs(numerator) < Math.abs(denominator)) { + return true; + } else { + return false; + } } // The line below allows us to load the isProperFraction function into tests in other files. @@ -24,6 +34,7 @@ function assertEquals(actualOutput, targetOutput) { actualOutput === targetOutput, `Expected ${actualOutput} to equal ${targetOutput}` ); + } // TODO: Write tests to cover all cases. @@ -31,3 +42,11 @@ function assertEquals(actualOutput, targetOutput) { // Example: 1/2 is a proper fraction assertEquals(isProperFraction(1, 2), true); +assertEquals(isProperFraction(2, 1), false); +assertEquals(isProperFraction(-1, 2), true); +assertEquals(isProperFraction(1, -2), true); +assertEquals(isProperFraction(0, 2), true); +assertEquals(isProperFraction(2, 2), false); +assertEquals(isProperFraction(-2, -1), false); +assertEquals(isProperFraction(-2, -2), false); +assertEquals(isProperFraction(1, 0), false); diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js index c7559e787..e512de871 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js @@ -23,6 +23,24 @@ function getCardValue(card) { // TODO: Implement this function + const rank = card.slice(0, -1); // Get the rank by slicing off the last character (the suit) + const suit = card.slice(-1); // Get the suit by taking the last character of the string + + // Validate the suit + const validSuits = ["♠", "♥", "♦", "♣"]; + if (!validSuits.includes(suit)) { + throw new Error("Invalid card: Invalid suit"); + } + // Determine the value based on the rank + if (rank === "A") { + return 11; + } else if (["J", "Q", "K"].includes(rank)) { + return 10; + } else if (!isNaN(rank) && parseInt(rank) >= 2 && parseInt(rank) <= 10) { + return parseInt(rank); + } else { + throw new Error("Invalid card: Invalid rank"); + } } // The line below allows us to load the getCardValue function into tests in other files.