This is my code.
def train(x_train,tree=None): features = x_train.keys()[:-1] info_gains=[] for ix in features: i_gain=info_gain(x_train,ix)