From 7fd77103ff83cb8e7f8840bdbe848df8b6e0c7fd Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Tue, 16 Jun 2026 23:35:59 +0100 Subject: [PATCH 01/23] capitalize function, str declaration --- Sprint-2/1-key-errors/0.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 653d6f5a07..4fd2184565 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -1,13 +1,19 @@ // Predict and explain first... -// =============> write your prediction here +// =============> write your prediction ==> This function it is going to capitalize the first character in a string. // call the function capitalise with a string input // interpret the error message and figure out why an error is occurring +const helloString = "hello" + function capitalise(str) { - let str = `${str[0].toUpperCase()}${str.slice(1)}`; - return str; + let newStr = `${str[0].toUpperCase()}${str.slice(1)}`; + return newStr; } + // =============> write your explanation here +//We receive an error message because the str was already been declared as parameter in the function. + // =============> write your new code here +console.log(capitalise(helloString)); From 88d76b490fba92b8e514e1d718092238624bbc1a Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Tue, 16 Jun 2026 23:53:25 +0100 Subject: [PATCH 02/23] Declaration and scope --- Sprint-2/1-key-errors/1.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-errors/1.js b/Sprint-2/1-key-errors/1.js index f2d56151f4..888566ab64 100644 --- a/Sprint-2/1-key-errors/1.js +++ b/Sprint-2/1-key-errors/1.js @@ -2,19 +2,23 @@ // Why will an error occur when this program runs? // =============> write your prediction here +// When trying to console.log(decimalNumber) we will occur an error bcs the decimalNumber +// was declared inside the function scop but console.log() is outside the function. -// Try playing computer with the example to work out what is going on +// Try playing computer with the example to work out what is going on + function convertToPercentage(decimalNumber) { - const decimalNumber = 0.5; + const percentage = `${decimalNumber * 100}%`; return percentage; } -console.log(decimalNumber); +console.log(convertToPercentage(0.5)); // =============> write your explanation here +// Also decimalNumber was declared as parameter in function. // Finally, correct the code to fix the problem // =============> write your new code here From b6def4503601ae7a06fa47e3c4b328cd6513412e Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 17 Jun 2026 00:05:06 +0100 Subject: [PATCH 03/23] Function parameters --- Sprint-2/1-key-errors/2.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index aad57f7cfe..1211188deb 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -4,17 +4,27 @@ // this function should square any number but instead we're going to get an error // =============> write your prediction of the error here +// When declaring a function we pass the parameter as variables. -function square(3) { - return num * num; -} + +// function square(3) { +// return num * num; +// } // =============> write the error message here +// Uncaught SyntaxError SyntaxError: Unexpected number + // =============> explain this error message here +// When we declare a function we pass the parameter names +// When we call a function we pass the values. // Finally, correct the code to fix the problem // =============> write your new code here +function square(num) { + return num * num; +} +console.log(square(4)); From d06f9a329d76f9c1c5c8beb2b1fc0596a3fe9707 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 17 Jun 2026 19:38:54 +0100 Subject: [PATCH 04/23] Add return a * b --- Sprint-2/2-mandatory-debug/0.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/0.js b/Sprint-2/2-mandatory-debug/0.js index b27511b417..e8d12cebdb 100644 --- a/Sprint-2/2-mandatory-debug/0.js +++ b/Sprint-2/2-mandatory-debug/0.js @@ -1,14 +1,25 @@ // Predict and explain first... // =============> write your prediction here +// This function does not return nothing. -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 +// It just console.log(a * b); // 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)}`); + From c15a48e1c95aeb5012bf77605fc536222c0f7c64 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 17 Jun 2026 19:43:23 +0100 Subject: [PATCH 05/23] Sum function fixed return --- Sprint-2/2-mandatory-debug/1.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/1.js b/Sprint-2/2-mandatory-debug/1.js index 37cedfbcfd..bf716ab876 100644 --- a/Sprint-2/2-mandatory-debug/1.js +++ b/Sprint-2/2-mandatory-debug/1.js @@ -1,13 +1,23 @@ // Predict and explain first... // =============> write your prediction here +// This function does not return nothing.return happens before a + b and the +// code below doesn't get executed. -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)}`); // =============> write your explanation here +// The return happens before a + b and the code below doesn't get executed. + // 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)}`); + From 66ddc970120a0ef7b21a1748a1bed592d71ecd2f Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 17 Jun 2026 19:54:09 +0100 Subject: [PATCH 06/23] Function with no parameter fixed --- Sprint-2/2-mandatory-debug/2.js | 39 +++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index 57d3f5dc35..a03b79d98e 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -2,23 +2,48 @@ // Predict the output of the following code: // =============> Write your prediction here +// This function will return always "3" -const num = 103; -function getLastDigit() { - return num.toString().slice(-1); -} +// const num = 103; + +// 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 +// 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 it is going to call always the num 103 declared with const in line 7. +// Because the function doesn't have a parameter variable and when we pas the value it calls the num variable in line 7. + + + // 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 +// Because the slice() method is always taking the number 103 From b82f3020b0f25109a62ccff4589d4d16db91f5cb Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 17 Jun 2026 20:07:33 +0100 Subject: [PATCH 07/23] Calculate BMI --- Sprint-2/3-mandatory-implement/1-bmi.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 17b1cbde1b..e297e1f150 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -15,5 +15,8 @@ // It should return their Body Mass Index to 1 decimal place function calculateBMI(weight, height) { + let = bodyMassIndex = weight / (height * height); + return bodyMassIndex.toFixed(1); // return the BMI of someone based off their weight and height -} \ No newline at end of file +} +console.log(calculateBMI(70,1.73)) \ No newline at end of file From 491605b722c48b936c574765c47d0f6b320d9762 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 17 Jun 2026 20:19:26 +0100 Subject: [PATCH 08/23] Capitalize function --- Sprint-2/3-mandatory-implement/2-cases.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index 5b0ef77ad9..e52b065e50 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -14,3 +14,11 @@ // 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 capitalize(string){ + return string.toUpperCase().replaceAll(" ","_"); + } + console.log(capitalize("hello there")); + console.log(capitalize("how are you")); \ No newline at end of file From b8a684cf4415cca68476b7f190d700cd7d29c88a Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 17 Jun 2026 20:30:21 +0100 Subject: [PATCH 09/23] Convert pence to pound function --- Sprint-2/3-mandatory-implement/3-to-pounds.js | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index 6265a1a703..887f421056 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -4,3 +4,42 @@ // 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 + + +// const penceString = "399p"; + +// 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"); + +// console.log(`£${pounds}.${pence}`); + +function convertPenceToPounds(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(convertPenceToPounds("299p")); +console.log(convertPenceToPounds("499p")); +console.log(convertPenceToPounds("25p")); +console.log(convertPenceToPounds("79p")); + + + From 095f72d2e3d91de1dc086aed5e489c1c31c5e0d2 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 17 Jun 2026 20:31:08 +0100 Subject: [PATCH 10/23] Removed comments --- Sprint-2/3-mandatory-implement/3-to-pounds.js | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index 887f421056..18d4245ff5 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -6,24 +6,6 @@ // You should call this function a number of times to check it works for different inputs -// const penceString = "399p"; - -// 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"); - -// console.log(`£${pounds}.${pence}`); function convertPenceToPounds(penceString){ @@ -34,8 +16,10 @@ function convertPenceToPounds(penceString){ const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0"); + return `£${pounds}.${pence}`; } + console.log(convertPenceToPounds("299p")); console.log(convertPenceToPounds("499p")); console.log(convertPenceToPounds("25p")); From 0a4c58773d4e112edcd27cd64a640a0efbe99fc0 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 17 Jun 2026 20:32:09 +0100 Subject: [PATCH 11/23] Add 2p example --- Sprint-2/3-mandatory-implement/3-to-pounds.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index 18d4245ff5..d766a92aa5 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -24,6 +24,8 @@ console.log(convertPenceToPounds("299p")); console.log(convertPenceToPounds("499p")); console.log(convertPenceToPounds("25p")); console.log(convertPenceToPounds("79p")); +console.log(convertPenceToPounds("2p")); + From 4aa639f0f1a1d678f33cb50ca99a28099f0e6e9c Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 17 Jun 2026 22:53:01 +0100 Subject: [PATCH 12/23] Time format pad() --- Sprint-2/4-mandatory-interpret/time-format.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Sprint-2/4-mandatory-interpret/time-format.js b/Sprint-2/4-mandatory-interpret/time-format.js index 17127bc01e..489f3d8e2c 100644 --- a/Sprint-2/4-mandatory-interpret/time-format.js +++ b/Sprint-2/4-mandatory-interpret/time-format.js @@ -14,6 +14,7 @@ function formatTimeDisplay(seconds) { return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`; } +console.log(formatTimeDisplay(61)) // You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit // to help you answer these questions @@ -21,18 +22,19 @@ function formatTimeDisplay(seconds) { // Questions // a) When formatTimeDisplay is called how many times will pad be called? -// =============> write your answer here +// =============> The function pad() is called 3 times. // 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 +// =============> When pad is called for the first time the value assigned to num is +// totalHours // c) What is the return value of pad is called for the first time? -// =============> write your answer here +// =============> The return value is 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 being called for 3 time is remainingSeconds. // e) What is the return value of pad when it is called for the last time in this program? Explain your answer -// =============> write your answer here +// =============> The return value of pad when called the last time is 01. From 892bb92611cb81927db9e65eb0b6222c17439ca9 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Mon, 22 Jun 2026 18:19:00 +0100 Subject: [PATCH 13/23] Fixed variable declaration for bodyMassIndex --- Sprint-2/3-mandatory-implement/1-bmi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index e297e1f150..52c2d5e5ff 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -15,7 +15,7 @@ // It should return their Body Mass Index to 1 decimal place function calculateBMI(weight, height) { - let = bodyMassIndex = weight / (height * height); + let bodyMassIndex = weight / (height * height); return bodyMassIndex.toFixed(1); // return the BMI of someone based off their weight and height } From 4bc146eaa45050573ff29d2fb06452de45de1a9f Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Tue, 30 Jun 2026 20:59:33 +0100 Subject: [PATCH 14/23] implement, 1-get-angle-type. --- .../implement/1-get-angle-type.js | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) 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 9e05a871e2..162c825772 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,6 +16,22 @@ 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. @@ -33,5 +49,32 @@ function assertEquals(actualOutput, targetOutput) { // TODO: Write tests to cover all cases, including boundary and invalid cases. // Example: Identify Right Angles + +const acute = getAngleType(45); +assertEquals(acute, "Acute angle"); + + const right = getAngleType(90); assertEquals(right, "Right angle"); + + +const obtuse = getAngleType(120); +assertEquals(obtuse, "Obtuse angle"); + + +const straight = getAngleType(180); +assertEquals(straight, "Straight angle"); + + +const reflex = getAngleType(200); +assertEquals(reflex, "Reflex angle"); + + +const invalid0 = getAngleType(0); +assertEquals(invalid0, "Invalid angle"); + +const invalid360 = getAngleType(360); +assertEquals(invalid360, "Invalid angle"); + + + From 4ccf833b903e2e0c2384fbefb94e3e199c1987c4 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Tue, 30 Jun 2026 22:23:26 +0100 Subject: [PATCH 15/23] implement, 2-is-proper-fraction --- .../implement/2-is-proper-fraction.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 970cb9b641..230c0c7f15 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 @@ -12,6 +12,11 @@ function isProperFraction(numerator, denominator) { // TODO: Implement this function + if(denominator === 0){ + return false; + } + let fraction = numerator / denominator; + return fraction > 0 && fraction < 1; } // The line below allows us to load the isProperFraction function into tests in other files. @@ -31,3 +36,17 @@ function assertEquals(actualOutput, targetOutput) { // Example: 1/2 is a proper fraction assertEquals(isProperFraction(1, 2), true); + +assertEquals(isProperFraction(0, 2), false); + +assertEquals(isProperFraction(2, 2), false); + +assertEquals(isProperFraction(5, 0), false); + +assertEquals(isProperFraction(-1, 2), false); + +assertEquals(isProperFraction(4, -3), false); + +assertEquals(isProperFraction(-5, -6), true); + +assertEquals(isProperFraction(-6, -5), false); From 4b20e6915a0b3500128e01b18c012c0951a711a9 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 1 Jul 2026 22:30:14 +0100 Subject: [PATCH 16/23] Implement, 3-get-card-value --- .../implement/3-get-card-value.js | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) 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 ff5c532e1d..118485975a 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,45 @@ function getCardValue(card) { // TODO: Implement this function + + let rank = card.slice(0, -1); + let suit = card.slice(-1); + + // Validate rank + if (rank !== "A" && + rank !== "2" && + rank !== "3" && + rank !== "4" && + rank !== "5" && + rank !== "6" && + rank !== "7" && + rank !== "8" && + rank !== "9" && + rank !== "10" && + rank !== "J" && + rank !== "Q" && + rank !== "K") + { + throw new Error("Invalid Rank"); + } + +// Validate suit + if(suit !== "♠" && + suit !== "♥" && + suit !== "♦" && + suit !== "♣" ) + { + throw new Error("Invalid Suit") + } + + if(rank == "A"){ + return 11; + } + else if(rank == "J" || rank == "Q" || rank == "K"){ + return 10; + } + else return Number(rank); + } // The line below allows us to load the getCardValue function into tests in other files. @@ -39,8 +78,31 @@ function assertEquals(actualOutput, targetOutput) { // TODO: Write tests to cover all outcomes, including throwing errors for invalid cards. // Examples: + +assertEquals(getCardValue("8♠"), 8); + +assertEquals(getCardValue("7♠"), 7); + +assertEquals(getCardValue("6♠"), 6); + +assertEquals(getCardValue("5♠"), 5); + +assertEquals(getCardValue("4♠"), 4); + +assertEquals(getCardValue("3♠"), 3); + +assertEquals(getCardValue("2♠"), 2); + assertEquals(getCardValue("9♠"), 9); +assertEquals(getCardValue("J♠"), 10); + +assertEquals(getCardValue("Q♠"), 10); + +assertEquals(getCardValue("K♠"), 10); + +assertEquals(getCardValue("A♠"), 11); + // Handling invalid cards try { getCardValue("invalid"); @@ -51,4 +113,23 @@ try { console.log("Error thrown for invalid card 🎉"); } + // What other invalid card cases can you think of? +try { + getCardValue("24♠"); + + // This line will not be reached if an error is thrown as expected + console.error("Error was not thrown for invalid card 😢"); +} catch (e) { + console.log("Error thrown for invalid rank 🎉"); +} + + +try { + getCardValue("44"); + + // This line will not be reached if an error is thrown as expected + console.error("Error was not thrown for invalid card 😢"); +} catch (e) { + console.log("Error thrown for invalid suit 🎉"); +} \ No newline at end of file From 6f270d239e07a5a828c0072081697e67a34e1aff Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Mon, 6 Jul 2026 17:39:58 +0100 Subject: [PATCH 17/23] Add comments to tests --- .../implement/2-is-proper-fraction.js | 7 +++++++ 1 file changed, 7 insertions(+) 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 230c0c7f15..3900b9b88e 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 @@ -37,16 +37,23 @@ function assertEquals(actualOutput, targetOutput) { // Example: 1/2 is a proper fraction assertEquals(isProperFraction(1, 2), true); +// Example: numerator is 0 is a proper fraction assertEquals(isProperFraction(0, 2), false); +// Example: numerator is equal to denominators is a proper fraction assertEquals(isProperFraction(2, 2), false); +// Example: denominator is 0 is a proper fraction assertEquals(isProperFraction(5, 0), false); +// Example: numerator is negative is a proper fraction assertEquals(isProperFraction(-1, 2), false); +// Example: denominator is negative is a proper fraction assertEquals(isProperFraction(4, -3), false); +// Example: numerator and denominator are both negative values is a proper fraction assertEquals(isProperFraction(-5, -6), true); +// Example: negative numerator with smaller value then negative dominator is a proper fraction assertEquals(isProperFraction(-6, -5), false); From 0799ea529667f54254c00ad9dcf8f03e09532832 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Mon, 6 Jul 2026 17:40:46 +0100 Subject: [PATCH 18/23] Update error message --- .../implement/3-get-card-value.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 118485975a..ead740f0c8 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 @@ -121,7 +121,7 @@ try { // This line will not be reached if an error is thrown as expected console.error("Error was not thrown for invalid card 😢"); } catch (e) { - console.log("Error thrown for invalid rank 🎉"); + console.log("Error thrown for invalid card 🎉"); } @@ -131,5 +131,5 @@ try { // This line will not be reached if an error is thrown as expected console.error("Error was not thrown for invalid card 😢"); } catch (e) { - console.log("Error thrown for invalid suit 🎉"); + console.log("Error thrown for invalid card 🎉"); } \ No newline at end of file From 956f63511fc1addf0884e3a75f6a3df065e0befa Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Mon, 6 Jul 2026 17:41:32 +0100 Subject: [PATCH 19/23] Add tests in Jest syntax --- .../1-get-angle-type.test.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index d777f348d3..02e5269775 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -13,8 +13,43 @@ test(`should return "Acute angle" when (0 < angle < 90)`, () => { expect(getAngleType(89)).toEqual("Acute angle"); }); + // Case 2: Right angle +test(`should return "Right angle" when ( angle = 90)`, () => { + // Test various right angles, including boundary cases + expect(getAngleType(90)).toEqual("Right angle"); + +}); + + // Case 3: Obtuse angles +test(`should return "Obtuse angle" when (90 < angle < 180)`, () => { + // Test various obtuse angles, including boundary cases + expect(getAngleType(91)).toEqual("Obtuse angle"); + expect(getAngleType(120)).toEqual("Obtuse angle"); + expect(getAngleType(179)).toEqual("Obtuse angle"); +}); + + // Case 4: Straight angle +test(`should return "Straight angle" when ( angle = 180)`, () => { + // Test various straight angles, including boundary cases + expect(getAngleType(180)).toEqual("Straight angle"); +}); + + // Case 5: Reflex angles +test(`should return "Reflex angle" when (180 < angle < 360)`, () => { + // Test various reflex angles, including boundary cases + expect(getAngleType(181)).toEqual("Reflex angle"); + expect(getAngleType(220)).toEqual("Reflex angle"); + expect(getAngleType(359)).toEqual("Reflex angle"); +}); + + // Case 6: Invalid angles +test(`should return "Invalid angle" when (180 < angle < 360)`, () => { + // Test various invalid angles, including boundary cases + expect(getAngleType(0)).toEqual("Invalid angle"); + expect(getAngleType(360)).toEqual("Invalid angle"); +}); From 5cec9c4161e3d013790933ba0107f3a613c4b68c Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Mon, 6 Jul 2026 17:42:21 +0100 Subject: [PATCH 20/23] Add test in Jest syntax --- .../2-is-proper-fraction.test.js | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 7f087b2ba1..447e9a104d 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -4,7 +4,43 @@ const isProperFraction = require("../implement/2-is-proper-fraction"); // TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. -// Special case: numerator is zero +// Special case: denominator is zero test(`should return false when denominator is zero`, () => { expect(isProperFraction(1, 0)).toEqual(false); }); + + +// Special case: numerator is zero +test(`should return false when numerator is zero`, () => { + expect(isProperFraction(0, 1)).toEqual(false); +}); + + +// Special case: numerator is equal to denominators is a proper fraction +test(`should return false when numerator is equal to denominator`, () => { + expect(isProperFraction(2, 2)).toEqual(false); +}); + + +// Special case: numerator is negative is a proper fraction +test(`should return false when numerator is negative value`, () => { + expect(isProperFraction(-1, 2)).toEqual(false); +}); + + +// Special case: denominator is negative is a proper fraction +test(`should return false denominator is negative value `, () => { + expect(isProperFraction(1, -2)).toEqual(false); +}); + + + // Special case: numerator and denominator are both negative values is a proper fraction// + test(`should return true when numerator ans denominator are both negative values `, () => { + expect(isProperFraction(-5, -6)).toEqual(true); +}); + + +// Special case: negative numerator with smaller value then negative dominator is a proper fraction +test(`should return false when negative numerator is smaller than negative denominator `, () => { + expect(isProperFraction(-6, -5)).toEqual(false); +}); From 1096cc20ae93455b203d30f961ca31d185f231ea Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Mon, 6 Jul 2026 21:04:03 +0100 Subject: [PATCH 21/23] Used array to validate rank & suit --- .../implement/3-get-card-value.js | 38 ++++++------------- 1 file changed, 12 insertions(+), 26 deletions(-) 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 ead740f0c8..859672057e 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 @@ -27,32 +27,18 @@ function getCardValue(card) { let rank = card.slice(0, -1); let suit = card.slice(-1); - // Validate rank - if (rank !== "A" && - rank !== "2" && - rank !== "3" && - rank !== "4" && - rank !== "5" && - rank !== "6" && - rank !== "7" && - rank !== "8" && - rank !== "9" && - rank !== "10" && - rank !== "J" && - rank !== "Q" && - rank !== "K") - { - throw new Error("Invalid Rank"); - } - -// Validate suit - if(suit !== "♠" && - suit !== "♥" && - suit !== "♦" && - suit !== "♣" ) - { - throw new Error("Invalid Suit") - } + const validRanks = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]; + const validSuits = ["♠", "♥", "♦", "♣"]; + + let isValidRank = validRanks.includes(rank); + let isValidSuit = validSuits.includes(suit); + + + +// Invalid Card +if( !isValidRank || !isValidSuit ){ + throw new Error("Invalid Card") +} if(rank == "A"){ return 11; From 6caf04c03358a49efd0ee16601c3ba0f22c96e77 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Mon, 6 Jul 2026 21:04:49 +0100 Subject: [PATCH 22/23] Add test in Jest syntax --- .../3-get-card-value.test.js | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index cf7f9dae2e..b891e10df3 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -4,17 +4,58 @@ const getCardValue = require("../implement/3-get-card-value"); // TODO: Write tests in Jest syntax to cover all possible outcomes. -// Case 1: Ace (A) +// Case 1: Ace (A) ♣ ♦ ♥ C test(`Should return 11 when given an ace card`, () => { expect(getCardValue("A♠")).toEqual(11); + expect(getCardValue("A♥")).toEqual(11); + expect(getCardValue("A♦")).toEqual(11); + expect(getCardValue("A♣")).toEqual(11); }); + + // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) // Face Cards (J, Q, K) // Invalid Cards + // To learn how to test whether a function throws an error as expected in Jest, // please refer to the Jest documentation: // https://jestjs.io/docs/expect#tothrowerror + +// Number cards +test(`Should return the number when given a number card`, () => { + expect(getCardValue("2♠")).toEqual(2); + expect(getCardValue("7♥")).toEqual(7); + expect(getCardValue("9♦")).toEqual(9); + expect(getCardValue("6♣")).toEqual(6); +}); + + +// Face Cards (J, Q, K) +test(`Should return 10 when given a face card`, () => { + expect(getCardValue("J♠")).toEqual(10); + expect(getCardValue("Q♥")).toEqual(10); + expect(getCardValue("K♦")).toEqual(10); +}); + + +// test(`Should throw an error when given an invalid card`, () => { +// expect(() => getCardValue("1♠")).toThrow(); +// expect(() => getCardValue("Z♦")).toThrow(); +// expect(() => getCardValue("11♥")).toThrow(); +// expect(() => getCardValue("")).toThrow(); +// }); + +// Invalid Cards +test(`Should throw an error when given an invalid card`, () => { + expect(() => getCardValue("1♣")).toThrow("Invalid Card"); + expect(() => getCardValue("Z♦")).toThrow("Invalid Card"); + expect(() => getCardValue("12♦")).toThrow("Invalid Card"); + expect(() => getCardValue("♦3")).toThrow("Invalid Card"); + expect(() => getCardValue("")).toThrow("Invalid Card"); + expect(() => getCardValue("invalid")).toThrow("Invalid Card"); + expect(() => getCardValue("----")).toThrow("Invalid Card"); +}); \ No newline at end of file From fdd00ab1c809a0117deaf881597217c14a3ea8c9 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Mon, 6 Jul 2026 22:50:29 +0100 Subject: [PATCH 23/23] Revert accidental changes to Sprint-2 files --- Sprint-2/1-key-errors/0.js | 12 ++---- Sprint-2/1-key-errors/1.js | 10 ++--- Sprint-2/1-key-errors/2.js | 16 ++------ Sprint-2/2-mandatory-debug/0.js | 19 ++------- Sprint-2/2-mandatory-debug/1.js | 20 +++------- Sprint-2/2-mandatory-debug/2.js | 39 ++++--------------- Sprint-2/3-mandatory-implement/1-bmi.js | 5 +-- Sprint-2/3-mandatory-implement/2-cases.js | 8 ---- Sprint-2/3-mandatory-implement/3-to-pounds.js | 25 ------------ Sprint-2/4-mandatory-interpret/time-format.js | 12 +++--- 10 files changed, 31 insertions(+), 135 deletions(-) diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 4fd2184565..653d6f5a07 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -1,19 +1,13 @@ // Predict and explain first... -// =============> write your prediction ==> This function it is going to capitalize the first character in a string. +// =============> write your prediction here // call the function capitalise with a string input // interpret the error message and figure out why an error is occurring -const helloString = "hello" - function capitalise(str) { - let newStr = `${str[0].toUpperCase()}${str.slice(1)}`; - return newStr; + let str = `${str[0].toUpperCase()}${str.slice(1)}`; + return str; } - // =============> write your explanation here -//We receive an error message because the str was already been declared as parameter in the function. - // =============> write your new code here -console.log(capitalise(helloString)); diff --git a/Sprint-2/1-key-errors/1.js b/Sprint-2/1-key-errors/1.js index 888566ab64..f2d56151f4 100644 --- a/Sprint-2/1-key-errors/1.js +++ b/Sprint-2/1-key-errors/1.js @@ -2,23 +2,19 @@ // Why will an error occur when this program runs? // =============> write your prediction here -// When trying to console.log(decimalNumber) we will occur an error bcs the decimalNumber -// was declared inside the function scop but console.log() is outside the function. - // Try playing computer with the example to work out what is going on - + function convertToPercentage(decimalNumber) { - + const decimalNumber = 0.5; const percentage = `${decimalNumber * 100}%`; return percentage; } -console.log(convertToPercentage(0.5)); +console.log(decimalNumber); // =============> write your explanation here -// Also decimalNumber was declared as parameter in function. // Finally, correct the code to fix the problem // =============> write your new code here diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index 1211188deb..aad57f7cfe 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -4,27 +4,17 @@ // this function should square any number but instead we're going to get an error // =============> write your prediction of the error here -// When declaring a function we pass the parameter as variables. - -// function square(3) { -// return num * num; -// } +function square(3) { + return num * num; +} // =============> write the error message here -// Uncaught SyntaxError SyntaxError: Unexpected number - // =============> explain this error message here -// When we declare a function we pass the parameter names -// When we call a function we pass the values. // Finally, correct the code to fix the problem // =============> write your new code here -function square(num) { - return num * num; -} -console.log(square(4)); diff --git a/Sprint-2/2-mandatory-debug/0.js b/Sprint-2/2-mandatory-debug/0.js index e8d12cebdb..b27511b417 100644 --- a/Sprint-2/2-mandatory-debug/0.js +++ b/Sprint-2/2-mandatory-debug/0.js @@ -1,25 +1,14 @@ // Predict and explain first... // =============> write your prediction here -// This function does not return nothing. -// 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 -// It just console.log(a * b); // 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 bf716ab876..37cedfbcfd 100644 --- a/Sprint-2/2-mandatory-debug/1.js +++ b/Sprint-2/2-mandatory-debug/1.js @@ -1,23 +1,13 @@ // Predict and explain first... // =============> write your prediction here -// This function does not return nothing.return happens before a + b and the -// code below doesn't get executed. -// 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)}`); // =============> write your explanation here -// The return happens before a + b and the code below doesn't get executed. - // 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 a03b79d98e..57d3f5dc35 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -2,48 +2,23 @@ // Predict the output of the following code: // =============> Write your prediction here -// This function will return always "3" +const num = 103; -// const num = 103; - -// 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)}`); - +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)}`); // Now run the code and compare the output to your prediction // =============> write the output here -// 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 it is going to call always the num 103 declared with const in line 7. -// Because the function doesn't have a parameter variable and when we pas the value it calls the num variable in line 7. - - - // 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 -// Because the slice() method is always taking the number 103 diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 52c2d5e5ff..17b1cbde1b 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -15,8 +15,5 @@ // It should return their Body Mass Index to 1 decimal place function calculateBMI(weight, height) { - let bodyMassIndex = weight / (height * height); - return bodyMassIndex.toFixed(1); // return the BMI of someone based off their weight and height -} -console.log(calculateBMI(70,1.73)) \ No newline at end of file +} \ No newline at end of file diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index e52b065e50..5b0ef77ad9 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -14,11 +14,3 @@ // 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 capitalize(string){ - return string.toUpperCase().replaceAll(" ","_"); - } - console.log(capitalize("hello there")); - console.log(capitalize("how are you")); \ No newline at end of file diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index d766a92aa5..6265a1a703 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -4,28 +4,3 @@ // 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 convertPenceToPounds(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(convertPenceToPounds("299p")); -console.log(convertPenceToPounds("499p")); -console.log(convertPenceToPounds("25p")); -console.log(convertPenceToPounds("79p")); -console.log(convertPenceToPounds("2p")); - - - - diff --git a/Sprint-2/4-mandatory-interpret/time-format.js b/Sprint-2/4-mandatory-interpret/time-format.js index 489f3d8e2c..17127bc01e 100644 --- a/Sprint-2/4-mandatory-interpret/time-format.js +++ b/Sprint-2/4-mandatory-interpret/time-format.js @@ -14,7 +14,6 @@ function formatTimeDisplay(seconds) { return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`; } -console.log(formatTimeDisplay(61)) // You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit // to help you answer these questions @@ -22,19 +21,18 @@ console.log(formatTimeDisplay(61)) // Questions // a) When formatTimeDisplay is called how many times will pad be called? -// =============> The function pad() is called 3 times. +// =============> write your answer here // 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? -// =============> When pad is called for the first time the value assigned to num is -// totalHours +// =============> write your answer here // c) What is the return value of pad is called for the first time? -// =============> The return value is 00 +// =============> write your answer here // d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer -// =============> The value assigned to num when pad is being called for 3 time is remainingSeconds. +// =============> write your answer here // e) What is the return value of pad when it is called for the last time in this program? Explain your answer -// =============> The return value of pad when called the last time is 01. +// =============> write your answer here