Difference makes the DIFFERENCE
Exercise 1:
- $\mbox{BMI} < 18.5$: UNDERWEIGHT
- $18.5 \leq \mbox{BMI} < 25$: NORMAL
- $25 \leq \mbox{BMI} < 30$: OVERWEIGHT
- $\mbox{BMI} \geq 30$: VERY-OVERWEIGHT
weight = input("Enter your weight in kgs ")
height_unit = input('What is your preferred unit of height "F" of feet and "M" for meters ')
if height_unit == "F":
print("I am in the F block. TODO")
else:
print("I am in the M block. TODO")
weight = input("Enter your weight in kgs ")
height_unit = input('What is your preferred unit of height "F" of feet and "M" for meters ')
if height_unit == "F":
feet = input("Please enter both feet and inches. Now enter feet ")
inches = input("Now enter inches ")
else:
meters = input("Please enter your height in meters ")
weight = input("Enter your weight in kgs ")
height_unit = input('What is your preferred unit of height "F" of feet and "M" for meters ')
if height_unit == "F":
feet = input("Please enter both feet and inches. Now enter feet ")
inches = input("Now enter inches ")
meters = (feet + inches/12) * 0.3048
else:
meters = input("Please enter your height in meters ")
height = meters
def input_single_integer(prompt):
ret = int(input(prompt))
return ret
weight = input("Enter your weight in kgs ")
height_unit = input('What is your preferred unit of height "F" of feet and "M" for meters ')
if height_unit == "F":
feet = input_single_integer("Please enter both feet and inches. Now enter feet ")
inches = input_single_integer("Now enter inches ")
meters = (feet + inches/12) * 0.3048
else:
meters = input("Please enter your height in meters ")
height = meters
print(meters)
def input_single_float(prompt):
ret = float(input(prompt))
return ret
weight = input_single_float("Enter your weight in kgs ")
height_unit = input('What is your preferred unit of height "F" of feet and "M" for meters ')
if height_unit == "F":
feet = input_single_integer("Please enter both feet and inches. Now enter feet ")
inches = input_single_integer("Now enter inches ")
meters = (feet + inches/12) * 0.3048
else:
meters = input_single_float("Please enter your height in meters ")
height = meters
bmi = weight / height**2
print("Your BMI is", bmi)
weight = input_single_float("Enter your weight in kgs ")
height_unit = input('What is your preferred unit of height "F" of feet and "M" for meters ')
if height_unit == "F":
feet = input_single_integer("Please enter both feet and inches. Now enter feet ")
inches = input_single_integer("Now enter inches ")
meters = (feet + inches/12) * 0.3048
else:
meters = input_single_float("Please enter your height in meters ")
height = meters
bmi = weight / height**2
print("Your BMI is", bmi)
if bmi < 18.5:
print("You are UNDERWEIGHT. Please consult doctor")
elif bmi < 25:
print("You are NORMAL. Great going.")
elif bmi < 30:
print("You are OVERWEIGHT. Watch out.")
else:
print("You are VERY OVERWEIGHT. Please consult doctor")