Q:

Iteratively assigning variables in Python

Never mind the placeholder variable names; how do I assign to D, E, and F in the way that I'm trying to do here?
print("Input 3 search coordinates")
D, E, F, = 0, 0, 0
    for axes in [[D, "Y"], [E, "X"], [F, "Z"]]:
        while True:
            try: 
                axes[0] = int(input("{}-Axis: ".format(axes[1])))
                break
            except:
                print("No, a natural number!")
        print(axes)
print(str(D) + str(E) + str(F))

This little bit of print debugging at the end outputs "000," rather than the inputs, like "444." What do I need in order to assign the inputs to the variables in the list being looped through (while also not repeating myself)?

A:

def get_input(axis):
    while True:
        user_input = input(f"{axis}-Axis: ")
        try:
            axis_int = int(user_input)
        except ValueError:
            continue
        else:
            break
    return axis_int

print("Input 3 search coordinates")
x, y, z = [get_input(axis) for axis in "XYZ"]

