题目 python代码 def maxProfit(prices): maxPro = 0 i = 1 while i < len(prices): profit = prices[i] - prices[i-1] if profit > 0: maxPro += profit i += 1 return maxPro