A list comprehension is using the same name as another variable defined in the module. Either change the variable name in the list comprehension or change it in the module.

Anti-pattern

In this example, the variable i is defined as 1 then reused in the list comprehension.

i = 1
squares = [i ** 2 for i in range(10)]

Best practice

i = 1
squares = [num ** 2 for num in range(10)]