<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_resource(self, resource):
 """Add a resource to the minimum needs table. :param resource: The resource to be added :type resource: dict """

        updated_sentence = NeedsProfile.format_sentence(
            resource['Readable sentence'], resource)
        if self.edit_item:
            item = self.edit_item
            item.setText(updated_sentence)
            self.edit_item = None
        else:
            item = QtWidgets.QListWidgetItem(updated_sentence)
        item.resource_full = resource
        self.resources_list.addItem(item)