Outputs
- Whenever you are generating numeric output, please use what you have learned about significant figures. Reporting values such as 50.344236903 provides information that has no real value (all of those decimal places are not meaningful) and more importantly distract from the user easily recognizing the result.
- Some lost points for not providing the BMI output characterization exactly as specified (for example, capitalizing the requested output instead of leaving it as lowercase as requested). This may seem picky, but functional specifications are written to ensure that different parts of larger software packages can effectively communicate with each other and must be met exactly so that these interfaces are clear.
Branching
- Avoid making feature branches from the end of the previous feature branch. After merging a branch on GitHub, always go to your local computer, checkout the
main branch, and then git pull the merged changes from GitHub. Then, you can make a new feature branch at that point.
- If, while you are on a feature branch, you discover a mistake in a feature that was developed on an earlier branch, do NOT fix that problem by checking out the earlier branch and fixing it there. By making changes on that earlier branch, it is likely to cause conflicts with changes that you have made since that branch was merged. Either go ahead and fix the problem on your current branch, or finish your current feature branch and then make a new branch that you can use to apply the fix.
No edits on main branch
- Don't edit README on the
main branch.
- No change, regardless of how small, should be made on the
main branch.
Testing-related modularity
- Separate input/output from any other algorithmic steps or calculation. This is primarily so that you can more easily reuse functionality in other parts of your code and it allows for easier unit testing.
- This separation of input/output from calculations includes
str and int and float type conversions. Those should be in functions that can be tested.
- For testing purposes, do not have a function like this:
def run():
wt, hght = get_input()
bmi = wt / hght**2
return bmi
While we do want to separate I/O from calculations, and this appears to do so by moving the input into the get_input function, this function cannot be tested because it still calls I/O which will cause problems with pytest.
Better:
def run():
wt, hght = get_input()
bmi = calc_bmi(wt, hght)
return bmi
def calc_bmi(wt, hght):
bmi = wt / hght**2
return bmi
Comparisons
- Be careful with ranged
if statements such as:
if 18.5 < BMI <= 24.9:
return "normal weight"
elif 25 <= BMI < 30:
return "overweight"
If your BMI was 24.95, it should return "normal weight", but it would not because 24.95 does not fall in the range of 18.5 < BMI <= 24.9. You would either need to make sure that you round the BMI to a single decimal point, or change it to be 18.5 < BMI < 25.
Outputs
Branching
mainbranch, and thengit pullthe merged changes from GitHub. Then, you can make a new feature branch at that point.No edits on
mainbranchmainbranch.mainbranch.Testing-related modularity
strandintandfloattype conversions. Those should be in functions that can be tested.get_inputfunction, this function cannot be tested because it still calls I/O which will cause problems withpytest.Better:
Comparisons
ifstatements such as:If your BMI was 24.95, it should return "normal weight", but it would not because 24.95 does not fall in the range of
18.5 < BMI <= 24.9. You would either need to make sure that you round the BMI to a single decimal point, or change it to be18.5 < BMI < 25.