text: Hi all,
  I am trying to figure out what’s wrong in my below code that gives back the following value while running :
  1699.8
  Traceback (most recent call last):
  File “script.py”, line 18, in
  x = get_returns(amazon_prices)
  File “script.py”, line 15, in get_returns
  y = calculate_log_return(i, i+1)
  File “/home/ccuser/workspace/analyzing-stock-data/utils.py”, line 6, in calculate_log_return
  return log(end_price / start_price)
  ZeroDivisionError: division by zero
  It gives the first price of “amazon_prices” and then specify a ZeroDivisionError meaning I’m trying to divide by 0, I guess the issue comes from the indexing but I’d need some help. would you mind to help me ?
  Here is the link:
  Here is my code:
  Write code here
  def get_returns(prices):
  returns =
  for i in range(len(prices)):
  print(prices[i])
  y = calculate_log_return(i, i+1)
  returns.append(y)
  x = get_returns(amazon_prices)
  print(x)