Professional Documents
Culture Documents
Farm Management
Farm Management
self.species = species
self.name = name
self.age = age
def __str__(self):
class Crop:
self.name = name
self.quantity = quantity
def __str__(self):
class Farm:
self.name = name
self.animals = []
self.crops = []
self.animals.append(animal)
self.crops.append(crop)
print(f"{crop.name} crop added to the farm.")
def feed_animals(self):
def harvest_crops(self):
print(f"Harvesting {crop.name}.")
def display_inventory(self):
print("Farm Inventory:")
print("Animals:")
if not self.animals:
else:
print(animal)
print("Crops:")
if not self.crops:
else:
print(crop)
# Sample usage
if __name__ == "__main__":
farm.add_animal(cow)
farm.add_animal(chicken)
farm.add_crop(wheat)
farm.add_crop(corn)
farm.feed_animals()
farm.harvest_crops()
farm.display_inventory()