Question about UndefVarError in for loop

Please quote your code: PSA: how to quote code with backticks

You need global a = a + n if you want to modify the global variable a from a for loop.

2 Likes