So I have this exercise and can’t solve it:
I can only accept a string, if it’s constructed of numbers AND letters, has to contain at least one of both; and it has to be 6-8 characters long. The string is only one word.
The first part is fine, though I’m not sure about using match:
re.match('([a-zA-Z]+[0-9]+)', string)
but I don’t know how to specify the length that it should be the length of both numbers and letters added up. This won’t work and I guess it shouldn’t anyway:
re.match('([a-zA-Z]+[0-9]+){6,8}', string)
Thanks for your help.
Try this one:
Explanation: