Answer:
class PatientData(): #declaration of PatientData class
height_inches=0 #attribute of class is declared and initialized to 0
weight_pounds=0 #attribute of class is declared and initialized to 0
Explanation:
Here is the complete program:
#below is the class PatientData() that has two attributes height_inches and weight_pounds and both are initialized to 0
class PatientData():
height_inches=0
weight_pounds=0
patient = PatientData() #patient object is created of class PatientData
#below are the print statements that will be displayed on output screen to show that patient data before
print('Patient data (before):', end=' ')
print(patient.height_inches, 'in,', end=' ')
print(patient.weight_pounds, 'lbs')
#below print statement for taking the values height_inches and weight_pounds as input from user
patient.height_inches = int(input())
patient.weight_pounds = int(input())
#below are the print statements that will be displayed on output screen to show that patient data after with the values of height_inches and weight_pounds input by the user
print('Patient data (after):', end=' ')
print(patient.height_inches, 'in,', end=' ')
print(patient.weight_pounds, 'lbs')
Another way to write the solution is:
def __init__(self):
self.height_inches = 0
self.weight_pounds = 0
self keyword is the keyword which is used to easily access all the attributes i.e. height_inches and weight_pounds defined within a PatientData class.
__init__ is a constructor which is called when an instance is created from the PatientData, and access is required to initialize the attributes height_inches and weight_pounds of PatientData class.
The program along with its output is attached.