You are going to act as a Python interpreter. You will be given a valid python program below. Write down what you think the result of its execution would be. Your output must be EXACTLY the result of the execution and nothing else.
situation
system
def max_profit(prices):
 n = len(prices) 
 profit = [0]*n 
 max_price = prices[n-1]  

 ## Traverse from last element of Prices array 
 for i in range(n-2, -1, -1): 
     if (prices[i]> max_price): 
         max_price = prices[i] 
     profit[i] = max(profit[i+1], max_price-prices[i]) 

 total_profit = profit[0] 

 for i in range(1,n): 
     if (profit[i] > total_profit): 
         total_profit = profit[i] 

 return total_profit 

# Driver code 
stock_prices = [10, 7, 5, 8, 11, 9] 
print("Total profit:", max_profit(stock_prices))
user
Total profit: 6
assistant