def lastCase(lst):
    for i in range(0, len(lst)):
        if lst[i] != '_':
            return False
return True
l = [''] * 4
l[0] = '0'
index = 0
while not lastCase(l):
    if ord(l[index]) > ord('_'):
        l[index] = '0'
index += 1
while l[index] == '_':
    l[index] = '0'
index += 1
if l[index] == '':
    l[index] = '0'
print(''.join(l))
l[index] = chr(ord(l[index]) + 1)
if ord(l[index]) > ord('9') and ord(l[index]) < ord('A'):
    l[index] = 'A'
elif ord(l[index]) > ord('Z') and ord(l[index]) < ord('_'):
    l[index] = '_'
index = 0
print(''.join(l))
Generate alphanumeric strings sequentially