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

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

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 desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 3. Chapter 5
toggle bottom row

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

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 desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 3. Chapter 5
toggle bottom row

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

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 desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

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 desktop for real-world practiceContinue from where you are using one of the options below
Section 3. Chapter 5
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt