How can i restrict letters after a number in an input in Python
#Try this:
def input_string():
x = input('str here: ')
if 2 <= len(x) <= 6:
number = False
for i in range(len(x)):
if i < 2:
if not x[i].isupper():
return False
else:
if not number and x[i] in [str(a) for a in range(10)]:
number = True
elif number:
if x[i] not in [str(a) for a in range(10)]:
return False
return True
return False