Foundations of Python

28 / 134

Hands-on on Python Variables

Now we know the operations and variables in Python. Let's write a program to calculate the BMI.

BMI = weight / (height * height)

Here weight is in kg (kilogram) and height is in mt (meters)

  • Define a variable height with value 1.7
  • Define a variable weight with value 72.25
  • Define a variable bmi and calculate the value of BMI using the above formula.
  • Convert bmi into int type.
  • Then print bmi using print(bmi). You should get 25 not 25.0.

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...