Calculating BMI
Task
Swipe to start coding
Given dictionary person with three keys: name, weight, and height. Your tasks are:
- Add new value to
persondictionary with keybmiand 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 apersonby respective key. - You need to apply
.format()method toinfostring passingpersondictionary as an argument and print the result.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 5
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Summarize this chapter
Explain the code in file
Explain why file doesn't solve the task
Awesome!
Completion rate improved to 4.35
Calculating BMI
Swipe to show menu
Task
Swipe to start coding
Given dictionary person with three keys: name, weight, and height. Your tasks are:
- Add new value to
persondictionary with keybmiand 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 apersonby respective key. - You need to apply
.format()method toinfostring passingpersondictionary as an argument and print the result.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 5
single