Skip to content

Conversation

@saff-coder
Copy link

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

Completed all the exercises in Sprint-2

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
@saff-coder saff-coder added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 24, 2025
Copy link
Contributor

@cjyuan cjyuan left a 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?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 25, 2025
@saff-coder
Copy link
Author

I reverted the commit from sprint 1

Copy link
Contributor

@cjyuan cjyuan left a 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.

Comment on lines 21 to 25
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
Copy link
Contributor

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.

Copy link
Author

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

Comment on lines 9 to 11
const pounds = kg * 2.20462;

return pounds;
Copy link
Contributor

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

Copy link
Author

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);
Copy link
Contributor

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?

Copy link
Author

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.

Copy link
Contributor

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?

Copy link
Author

Choose a reason for hiding this comment

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

Screenshot 2025-10-26 185042

Copy link
Contributor

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?

Copy link
Author

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

Comment on lines 9 to 10
const pounds = kg * 2.20462;
return `${pounds.toFixed(2)} lbs`; // returns a string
Copy link
Contributor

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.

Copy link
Author

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

Copy link
Contributor

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

Copy link
Author

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

Copy link
Contributor

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?

Copy link
Author

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

@saff-coder saff-coder requested a review from cjyuan October 30, 2025 16:29
@cjyuan
Copy link
Contributor

cjyuan commented Oct 30, 2025

Changes look good. You forgot to change the label.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants