Algorithm with if...else

Tip: use a triple backtick fence around your code to make it more legible.

I’m still not sure what your perceived problem is, but I see one problematic line:

else TSH = 1.5

The else here does not introduce a new if, and the TSH = 1.5 assigns 1.5 to TSH, it doesn’t compare them. You might want == (or ).

Also, if that’s supposed to be a new if, don’t forget to add a base case: what happens if none of the cases match.

1 Like