Question: We will create a Person class in this question. A person has a name ( str ) , age ( int ) , weight (

We will create a Person class in this question. A person has a name (str), age (int), weight (float), and height (float). The basic template has been provided for you below:
class Person(object):
"""Defines a Person class, suitable for use in a hospital context.
Data attributes: name of type str
age of type int
weight (kg) of type float
height (meters) of type float
"""
def __init__(self, name, age, weight, height):
"""Creates a new Person object with the specified name, age, weight
and height"""
self.name = name
self.age = age
self.weight = weight
self.height = height
Your task
Your task is to write a method bmi, which returns the BMI value of the person. The BMI value can be calculated by dividing the weight of the person by height squared.
BMI = weight /(height^2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!