What's my Body Mass Index?
Python, 69 bytes
lambda w,h:["UOnvd"[w/h/h>20::2]+"erweight","Normal"][18.5<=w/h/h<25]
Try it online!
Compare to 72 bytes:
lambda w,h:"Underweight"*(w/h/h<18.5)or"Normal"*(w/h/h<25)or"Overweight"
TI-Basic, 58 54 bytes
Input
X/Y²→C
"NORMAL
If 2C≤37
"UNDERWEIGHT
If C≥26
"OVERWEIGHT
Also, for fun, here's a more compact version that is more bytes:
Prompt A,B
sub("UNDERWEIGHTNORMAL OVERWEIGHT ",sum(A/B²≥{18.5,25})11+1,11
All I can say is, thank you for making this case-insensitive ;)
P.S. Input
takes graph input to X
and Y
similar to Prompt X,Y
Jelly, 24 bytes
÷÷⁹Ḥ“%2‘>Sị“$⁽¿“;ṅẒ“&ċ)»
Try it online!
How?
Calculates the BMI, doubles it, compares that with the greater than operator with each of the numbers 37 and 50 (18.5 and 25 doubled), sums the resulting ones and zeros (yielding 1, 2, or 0 for Normal, Underweight, and Overweight respectively) and indexes into the list of strings ["Normal","Underweight","Overweight"]
.
÷÷⁹Ḥ“%2‘>Sị“$⁽¿“;ṅẒ“&ċ)» - Main link: weight, height
÷ - weight ÷ height
⁹ - right argument, height
÷ - ÷ by height again to get the BMI
Ḥ - double the BMI
“%2‘ - list of code page indexes [37,50]
> - greater than? (vectorises) - i.e [18.5>bmi, 25>bmi]
S - sum -- both:=2 (Underweight), just 50:=1 (Normal) or neither:=0 (Overweight)
ị - index into (1-based)
“$⁽¿“;ṅẒ“&ċ)» - compressed list of strings ["Normal","Underweight","Overweight"]
- implicit print