[CentralOH] Solution for Max Stock Profit

Kenneth Patierno kennethpatierno at gmail.com
Thu Mar 7 20:04:09 EST 2019


Cheers!

KENNY PATIERNO

*p : *614 <614-902-7379>-902-7379
*e : *kennethpatierno at gmail.com
[image: Facebook]  <https://www.facebook.com/kenny.patierno>[image:
Instagram]  <https://www.instagram.com/kennypatierno/>[image: Twitter]
<https://twitter.com/kenny_patierno>

ᐧ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20190307/9cf3b3d9/attachment.html>
-------------- next part --------------
stock_prices = [40,13,70,3,8,43,54,12,7,90,8]

max_profit = -99

for stock_price in stock_prices:
	buy_price = stock_price
	for sell_price in stock_prices:
		net_profit = sell_price - buy_price
		if net_profit > max_profit:
			max_profit = net_profit
	stock_prices.pop(stock_prices.index(stock_price))
print("\nTotal Max Profit Available = $" + str(max_profit))


More information about the CentralOH mailing list