IMAGE SOURCE
RESPOSITORY: PYTHON, OPEN SOURCE RESPOSITORY
WHAT YOU WILL LEARN:
- WHAT IS A BMI
- WHAT A BMI CALCULATOR IS
- FORMULA FOR SOLVING BMI
- CODING A BMI CALCULATOR TO DETERMINE IF A MAN IS OVERWEIGHT
REQUIREMENTS:
- A COMPUTER SYSTEM/ PC/ SMARTPHONE
- PYTHON SOFTWARE
DIFFICULTY: BASIC
CONTENTS
WHAT IS BMI: BMI simply stands for BODY MASS INDEX.
WHAT A BMI CALCULATOR IS: A BMI calculator is a calculator that is ised to detect if a man is overweight through his/her weight and height.
FORMULA FOR SOLVING BMI: The formula is kg/m² where by kg is a persons weight in kilogram and m² is a person height squared.
CODING A BMI CALCULATOR: Coding a BMI calculator is simply done by the steps below:
IF NOT OVERWEIGHT:
name = "Kenechukwu"
height_m = 3
weight_kg = 20
bmi = weight_kg / (height_m ** 2)
print("bmi: ")
print(bmi)
if bmi < 25:
print(name)
print("is not overweight")
else:
print(name)
print("is overweight")
OUTPUT:
This code is assigned to calculate a subject "Kenechukwu" to calculate his bmi and determine if he is overweight or not.
A man is labelled overweight if his BMI is 25 or more. The code below shows our subject is not over weight now ill re-write the code to make our subject overweight and see
IF OVERWEIGHT:
name = "Kenechukwu"
height_m = 1
weight_kg = 500
bmi = weight_kg / (height_m ** 2)
print("bmi: ")
print(bmi)
if bmi < 25:
print(name)
print("is not overweight")
else:
print(name)
print("is overweight")
As you can see the bmi has been determined and clearly our subject is overweight.
PROOF OF WORK
My other tutorials include: