Big Data with Spark - Flat 33% OFF   Offer ends in

Python Introduction

8 / 11

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 assign the calculated BMI to this variable
  • Print bmi using print(bmi). You should get 25