Aug-23-2021, 02:10 PM
Hi all!
Here's some code:
Here's some code:
price_chg = np.arange(-10,11,2) stock_prices = [100] for i in range(10001): if (stock_prices[-1] + np.random.choice(price_chg)) < 0: stock_prices.append(0) continue else: stock_prices.append(stock_prices[-1] + np.random.choice(price_chg))Why is the if block failing to keep negative integers out of the list?