Ask Question
14 September, 10:27

Declare a class named Patient

Data that contains two data members named height_inches and weight_pounds.

Sample output for the given program:

Patient data (before) : 0 in, 0 lbsPatient data (after) : 63 in, 115 lbsclass Patientdа ta:def __init__ (self, height_inches = 0, weight_pounds = 0) : self. height_inches = 0self. weight_pounds = 0 lunaLovegood = PatientData () print ('Patient data (before) : ', end=' ') print (lunaLovegood. height_inches, 'in,', end=' ') print (lunaLovegood. weight_pounds, 'lbs') lunaLovegood. height_inches = 63lunaLovegood. weight_pounds = 115print ('Patient data (after) : ', end=' ') print (lunaLovegood. height_inches, 'in,', end=' ') print (lunaLovegood. weight_pounds, 'lbs')

+2
Answers (1)
  1. 14 September, 10:39
    0
    class Patientdа ta:

    def __init__ (self, height_inches = 0, weight_pounds = 0):

    self. height_inches = 0

    self. weight_pounds = 0

    lunaLovegood = PatientData ()

    print ('Patient data (before) : ', end=' ')

    print (lunaLovegood. height_inches, 'in,', end=' ')

    print (lunaLovegood. weight_pounds, 'lbs')

    lunaLovegood. height_inches = 63

    lunaLovegood. weight_pounds = 115

    print ('Patient data (after) : ', end=' ')

    print (lunaLovegood. height_inches, 'in,', end=' ')

    print (lunaLovegood. weight_pounds, 'lbs')

    Explanation:

    Output is as below

    Patient data (before) : 0 in, 0 lbs

    Patient data (after) : 63 in, 115 lbs
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Declare a class named Patient Data that contains two data members named height_inches and weight_pounds. Sample output for the given ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers