Зміст курсу
String Manipulation in Python
String Manipulation in Python
Calculating BMI
Swipe to show code editor
Given dictionary person
with three keys: name
, weight
, and height
. Your tasks are:
- Add new value to
person
dictionary with keybmi
and valueweight/height**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 aperson
by respective key. - You need to apply
.format()
method toinfo
string passingperson
dictionary as an argument and print the result.
Дякуємо за ваш відгук!
Calculating BMI
Swipe to show code editor
Given dictionary person
with three keys: name
, weight
, and height
. Your tasks are:
- Add new value to
person
dictionary with keybmi
and valueweight/height**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 aperson
by respective key. - You need to apply
.format()
method toinfo
string passingperson
dictionary as an argument and print the result.
Дякуємо за ваш відгук!
Calculating BMI
Swipe to show code editor
Given dictionary person
with three keys: name
, weight
, and height
. Your tasks are:
- Add new value to
person
dictionary with keybmi
and valueweight/height**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 aperson
by respective key. - You need to apply
.format()
method toinfo
string passingperson
dictionary as an argument and print the result.
Дякуємо за ваш відгук!
Swipe to show code editor
Given dictionary person
with three keys: name
, weight
, and height
. Your tasks are:
- Add new value to
person
dictionary with keybmi
and valueweight/height**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 aperson
by respective key. - You need to apply
.format()
method toinfo
string passingperson
dictionary as an argument and print the result.