Land yield comparison

Suppose that you have three different land parcels and you use them to grow exlusively three types of nut trees—almonds, walnuts and hazelnuts. You know the dimensions of the parcels, the number of trees you have in each one, the average yield per tree and the current product market prices for this nut type in dollar per kg. You would like to know which places and trees give you the highest benefit.

parcel_data = [ # location_name, width (m), height (m), num trees, tree type, avg. yield per tree (kg), avg. product market price ($/kg) [140, 320, 350, 'almond', 16.6, 15], [390, 360, 290, 'walnut', 19.8, 18], [190, 240, 230, 'hazelnut', 9.5, 27] ] for width, height, trees, tree_type, avg_yield, avg_kg_price in parcel_data: area = width * height value_produced = trees * avg_yield * avg_kg_price efficiency = value_produced / area print(': '.join([tree_type.title() + ' parcel', "%.4f $/sqm" % efficiency])) """ Almond parcel: 1.9453 $/sqm Walnut parcel: 0.7362 $/sqm Hazelnut parcel: 1.2937 $/sqm """

It looks like the parcel with the almonds is connected with the highest revenue. However, these numbers must be placed next to the invested amounts (amortized over the planned production period) to see whether the production was profitable at all.