Change property of a set of multiple objects with python script
This was supposed to be the non-Python solution:

Do a rightclick on the first of your objects.
Go to the menu Select >> Select Pattern...

Type in "X??". That'll select all objects starting with X being 3 characters long.

Road one:

Enter the desired number into the Distance field of your active object.
Right-click the button and choose 'Copy To Selected'

Road two:

Alt-leftclick the button and enter the number. All objects will have the same value.

That was the plan until I actually tried it. Doesn't work. Blender thinks that stuff isn't copyable, so, Python it is.

import bpy

prefix = 'X'
dist = 7.0 # distance you wish to copy
llevel = 1 # change for higher levels

c = 0 # just a counter to create a sense of accomplishment
for a in bpy.data.objects: # goes through all objects in your blendfile
    n = a.name # get the object's name
    if len(n) == 3 and n[0] == prefix: # If the names length is 3 and starts with x
        if len(a.lod_levels) &gt; 0: # and if there actually are lod levels
            a.lod_levels[llevel].distance = dist # then assign the distance to them
            c += 1

print("I have successfully changed {} Objects".format(c)) # victory message


It's actually not too far away from your pseudocode, so I hope your survivability regarding python powers will increase.