validation:
username should be in between 4 and 25
should start with letters but not underscore
should not be special characters
input:
output:
true
input:
google@123
output:
false
import string
def validate(name):
if len(name) < 4 or len(name) > 25:
return False
if name[0] not in string.ascii_letters:
return False
for ch in name:
if (ch not in string.ascii_letters and
ch not in string.digits and ch != '_'):
return False
return True
def main():
name = input()
if validate(name):
print('true')
else:
print('false')
if __name__ == '__main__':
main()
Comments
Leave a comment