Here’s the complete implementation of the program based on your prompts:
- Create a class for the boxes.
class Box:
def __init__(self, date, contents, location):
self.date = date
self.contents = contents
self.location = location
- Create instances of the class for the specified boxes.
box_23 = Box("2016", "medical records", "storage closet")
box_21 = Box("2018", "lotion samples", "waiting room")
box_07 = Box("2020", "flyers about the flu shot", "receptionist’s desk")
- Write statements to print out the required attributes of the boxes.
print(box_23.date)
print(box_07.contents)
print(box_21.location)
- Write a method to check if two boxes are identical.
def are_boxes_identical(box1, box2):
return (box1.date == box2.date and
box1.contents == box2.contents and
box1.location == box2.location)
- Create box #10, and write comparison statements for the specified boxes.
box_10 = Box("2020", "flyers about the flu shot", "receptionist’s desk") # Same attributes as box #07
# Comparison statements
print(are_boxes_identical(box_07, box_10)) # Should print True
print(are_boxes_identical(box_21, box_23)) # Should print False
Put together, this code provides a complete program to keep track of boxes in a doctor's office while fulfilling all the requirements laid out in your prompts.