Consider a hospital scenario. Design classes for:
Patients. The class might have fields like unique ID for the patient, name, male or female, age, address, phone number, date of birth, height, and weight.

I need help with this problem

Look. It's a bit presumptuous, if not rude, to ask people to do your homework without even making a token attempt, yourself. Do you have any code written? Do you understand classes/objects at all in some other context maybe?

Think of it this way:
There is a class, "patient". Objects in that class have some attributes: age, weight, sex, dob, name, ID, address, phone number.

class patient():
      def __init__(self, ID, name, dob, sex, phonenumber, address):
          self.ID=ID
          self.address=address

bob=patient("0012","bob","8/8/88","m","888-8888","888 Oak")
class patient(object):
    def __init__(self, ID, name, john, gender, phonenumber, address):
        self.ID=ID
        self.address=address
        john=patient("5640","john","8/8/88","m","334-456-7898","60 Hilltop")
    def get_name(self):
        return self._name

I am confused about the "set" method little help

Think about it like this:
when you set "self.address=address", you are assigning a value to an attribute. If that were inside a method, say, "set_address(address)" and looked exactly the same, would that be what you wanted?

Also, your "get_name" method is wrong, I think. There is no attribute defined to be "_name".

Some observations are due:

class Patient(object):
    # by convention class names are capitalized
    def __init__(self, ID, name, bdate, gender, phone, address):
        # assing class parameters to instance self
        self.ID = ID
        self.name = name
        self.address = address
        # and so on

    def get_name(self):
        "this is a class method, first arg is self"
        print("Patient name = %s" % self.name)

    def set_name(self, newname):
        "method to change the name"
        self.name = newname



# create an instance of the class
# data have to be in this order
# Patient(ID, name, bdate, gender, phone, address)
john = Patient("5640","John","8/8/88","m","334-456-7898","60 Hilltop")

# get ID
print(john.ID) 

# use a method of the class instance
john.get_name()

# change the name
john.set_name("Johnathan Miller")
# now
john.get_name()

'''
5640
Patient name = John
Patient name = Johnathan Miller
'''

Edited 4 Years Ago by sneekula

The way sneekula has written the class code, it would be very easy to change for instance the name of the patient from outside the class ...

class Patient(object):
    # by convention class names are capitalized
    def __init__(self, ID, name, bdate, gender, phone, address):
        # assing class parameters to instance self
        self.ID = ID
        self.name = name
        self.address = address
        # and so on

    def get_name(self):
        "this is a class method, first arg is self"
        print("Patient name = %s" % self.name)

    def set_name(self, newname):
        "method to change the name"
        self.name = newname



# create an instance of the class
# data have to be in this order
# Patient(ID, name, bdate, gender, phone, address)
john = Patient("5640","John","8/8/88","m","334-456-7898","60 Hilltop")

# could be too easy to change the name by mistake
john.name = "Fred Flintstone"

john.get_name()  # Patient name = Fred Flintstone

To prevent this you can use the double underline prefix ...

class Patient(object):
    # by convention class names are capitalized
    def __init__(self, ID, name, bdate, gender, phone, address):
        # assing class parameters to instance self
        self.ID = ID
        # the double underline prefix keeps __name private to the class 
        self.__name = name
        self.address = address
        # and so on

    def get_name(self):
        "this is a class method, first arg is self"
        print("Patient name = %s" % self.__name)

    def set_name(self, newname):
        "method to change the name"
        self.__name = newname



# create an instance of the class
# data have to be in this order
# Patient(ID, name, bdate, gender, phone, address)
john = Patient("5640","John","8/8/88","m","334-456-7898","60 Hilltop")

# the double underline prefix protects
# from easy name changes
john.__name = "Fred Flintstone"

john.get_name()  # Patient name = John
This question has already been answered. Start a new discussion instead.