Issue with variable not updating in loop
09:45 20 Feb 2026

I'm having an issue where my variable x isn't updating correctly inside my loop. I've looked at 15 other threads and none of them work for my specific case.

def check_data(input_list):
    for i in range(len(input_list)):
        # logic goes here
        x = 10
        # ...
        # more logic
    return x

# why is x always 10??

I’m using a custom OS my friend made, so I can’t use standard debugging tools. Also, I’m restricted to Python 2.6 for legacy reasons, so please don’t suggest anything from the last 15 years.

python