def maxprofit(mylist): profit = 0 bestbuyPriceindex= 0 bestsalePriceindex = 0 answerlist = x= 0 y =0 while x lt; len(mylist): while y…

def maxprofit(mylist):

profit = 0 

bestbuyPriceindex= 0

bestsalePriceindex = 0

answerlist = []

x= 0 

y =0

while x < len(mylist):

while y <len(mylist):

if (mylist[y] – mylist[x])> profit:

bestbuyPriceindex= x

bestsalePriceindex=y 

y+=1

x+=1

y=x

answerlist.append(bestbuyPriceindex)

answerlist.append(bestsalePriceindex)

answerlist.append(profit)

I’M having trouble running this (python) because i’m not sure where i should put the return statements to actually get results.