#!/usr/bin/python

import argparse

def find_max_profit(prices):
    # for every value, compare with each subsequent value
    max_profit = prices[1] - prices[0]  # assumes at least two prices

    for i, buying_price in enumerate(prices):
        for selling_price in prices[i+1:]:
            profit = selling_price - buying_price
            if profit > max_profit:
                max_profit = profit
    return max_profit


if __name__ == '__main__':
    # This is just some code to accept inputs from the command line
    parser = argparse.ArgumentParser(description='Find max profit from prices.')
    parser.add_argument('integers', metavar='N', type=int, nargs='+', help='an integer price')
    args = parser.parse_args()

    print("A profit of ${profit} can be made from the stock prices {prices}.".format(profit=find_max_profit(args.integers), prices=args.integers))