Python error "TypeError: unsupported operand type(s) for -: 'list' and 'int'"
The issue with your code is that on the last second line you are trying to subtract 1 from a list, which is why you are getting this error. I think what you are trying to do is this:
chain.append(np.random.choice(word_dict[chain[-1]]))