Is there a better way to do this?
I want the code to detect numbers and special characters and print:
"numbers not allowed" / "special characters not allowed"
while True:
try:
x = input('Enter an alphabet:')
except ValueError:
print('sorry i do not understand that')
continue
if x in ('1', '2','3','4','5','6','7','8','9','0'):
print('Numbers not allowed')
continue
else:
break
if x in ('a', 'e', 'i', 'o', 'u'):
print ('{} is a vowel'.format(x))
elif x in ('A', 'E', 'I', 'O', 'U'):
print ('{} is a vowel in CAPS'.fotmat(x))
else:
print('{} is a consonant'.format(x))