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
course content

Course Content

String Manipulation in Python

String Manipulation in Python

1. Basic Concepts
2. String Methods
3. Strings Formatting

bookCalculating 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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 5
toggle bottom row

bookCalculating 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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 5
toggle bottom row

bookCalculating 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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

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.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 3. Chapter 5
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt