## Problem Description and Formulation

The neighbourhood community wants to maximize their profit by determining the number of sheds and treehouses to build and paint, given the available hours for building and painting.

Let's define the decision variables:
- $S$ as the number of sheds to build
- $T$ as the number of treehouses to build

The objective function to maximize profit is:
\[ \text{Maximize:} \quad 700S + 500T \]

Subject to the constraints:
1. Building time constraint: $4S + 2T \leq 40$
2. Painting time constraint: $2S + 1.5T \leq 30$
3. Non-negativity constraint: $S \geq 0, T \geq 0$

## Gurobi Code

To solve this linear programming problem using Gurobi in Python, we can use the following code:

```python
import gurobi

def solve_optimization_problem():
    # Create a new model
    model = gurobi.Model()

    # Define the decision variables
    S = model.addVar(lb=0, name="Sheds")
    T = model.addVar(lb=0, name="Treehouses")

    # Define the objective function
    model.setObjective(700*S + 500*T, gurobi.GRB.MAXIMIZE)

    # Add constraints
    model.addConstr(4*S + 2*T <= 40, name="Building_Time")
    model.addConstr(2*S + 1.5*T <= 30, name="Painting_Time")

    # Optimize the model
    model.optimize()

    # Check if the model is optimized
    if model.status == gurobi.GRB.Status.OPTIMAL:
        # Get the optimized values
        sheds = S.varValue
        treehouses = T.varValue
        max_profit = model.objVal

        print(f"Optimal solution: Build {sheds} sheds and {treehouses} treehouses.")
        print(f"Maximum profit: ${max_profit:.2f}")
    else:
        print("The model is infeasible.")

# Run the optimization problem
solve_optimization_problem()
```

This code defines the optimization problem using Gurobi, solves it, and prints out the optimal solution and the maximum profit if the model is feasible. If the model is infeasible, it indicates that there is no solution that satisfies all the constraints.