!pip install gym import random import numpy as np import matplotlib.pyplot as plt from keras.layers import Dense, Dropout, Activation from keras.models import Sequential from keras.optimizers import Adam from keras import backend as K from collection…