-
-
Notifications
You must be signed in to change notification settings - Fork 240
London | 25-ITP-SEP | Sophia Mohamed | Sprint 2 | coursework/sprint-2 #803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
London | 25-ITP-Sept | Sophia Mohamed | Sprint 1 | coursework/sprint-1
The codes are fixed, the error has been corrected and explained
The prediction and explanation were done
1. Calculating the BMI 2. Change a sentence from lowercase to uppersnake case 3. Changing from Kg to lb
I run the code in Python Visualiser and answered all the questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch is not clean -- It includes changes in the Sprint-1 folder (which is not related to Sprint-2 exercise). Can you revert the changes made in the Sprint-1 folder?
This reverts commit 7312985.
|
I reverted the commit from sprint 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job in reverting the changes made in Sprint-1 folder.
| let bmi = 85 / (1.54 * 1.54); | ||
| console.log(bmi) | ||
| //here the result was 35.833307439446366 I need to round it to 1 decimal place | ||
| console.log(bmi.toFixed(1)); | ||
| //now the output is 35.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The objective of this exercise is to complete the implementation of the function calculateBMI() so that we can reuse the code in the function to calculate BMI for different weight and height.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the function
| const pounds = kg * 2.20462; | ||
|
|
||
| return pounds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This toPounds() function is supposed to convert a pence string to a string in British pounds format, like what you did in Sprint-1/3-mandatory-interpret/3-to-pounds.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the code as required
This function converts the weight in kg to pounds
| const bmi = weight / (height * height); | ||
|
|
||
| // Round to 1 decimal place and return | ||
| return bmi.toFixed(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these function calls output 123 in the console, but internally in the program,
the number 123 and the string "123" are stored and treated differently.
console.log(123);
console.log("123");What type of value do you expect your function to return? A number or a string?
Does your function return the type of value you expect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect the function to return a number, because a BMI is a numeric value. Yes, I tested the function, and it comes as a number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you test if its return value is a number and not a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not a proper way to check the type of a value.
Can you ask AI (and then verify if needed) how to determine the type of a value in JS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much, that was really helpful. I used (type of )and it showed me that my output was a string, and I changed it to a number
| const pounds = kg * 2.20462; | ||
| return `${pounds.toFixed(2)} lbs`; // returns a string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not what is expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed the code, and the output is a number, not a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is supposed to convert pence to British pounds (similar to what you did in Sprint-1/3-mandatory-interpret/3-to-pounds.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this question is to convert the weight from kilograms to Pounds, not British pounds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What makes you think that? What does the comments (lines 1-60 in the file say?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for all your help
I was able to test my data type using typeof
|
Changes look good. You forgot to change the label. |

Learners, PR Template
Self checklist
Changelist
Completed all the exercises in Sprint-2