Explore Library
Code QuizIntermediate

Monte Carlo Return Estimation

Identify the discounting error in this Monte Carlo return calculation.

Codepython
def compute_return(rewards, gamma):
    G = 0
    for t, r in enumerate(rewards):
        # discount each reward by its time step
        G += gamma * r
    return G

What is the bug in this Monte Carlo return computation?