prices = [7, 1, 5, 3, 6, 4]

min_price = prices[0]
max_profit = 0

for price in prices:
    if price < min_price:
        min_price = price
    elif price - min_price > max_profit:
        max_profit = price - min_price

print(max_profit)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: