Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Calculating BMI | Strings Formatting
String Manipulation in Python

Calculating BMICalculating BMI

Task

Given dictionary person with three keys: name, weight, and height. Your tasks are:

  1. Add new value to person dictionary with key bmi and value weight/height**2.
  2. Create pattern named info "name weight is weight kg, height is height m. BMI is bmi". Everything there written in italics is the value of a person by respective key.
  3. You need to apply .format() method to info string passing person dictionary as an argument and print the result.

Everything was clear?

Section 3. Chapter 5
toggle bottom row
course content

Course Content

String Manipulation in Python

Calculating BMICalculating BMI

Task

Given dictionary person with three keys: name, weight, and height. Your tasks are:

  1. Add new value to person dictionary with key bmi and value weight/height**2.
  2. Create pattern named info "name weight is weight kg, height is height m. BMI is bmi". Everything there written in italics is the value of a person by respective key.
  3. You need to apply .format() method to info string passing person dictionary as an argument and print the result.

Everything was clear?

Section 3. Chapter 5
toggle bottom row
some-alt