i have this error
local variable ‘k’ referenced before assignment…
means, probably you’d forgot to give
k some value before line 92. If k is not assigned anything, then it couldn’t be compared.
This is the most I can conclude from your snapshots.