Advertisement
DiYane

Valid usernames

Sep 26th, 2023
1,522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. def valid_username(username):
  2.     allowed_symbols = ['_', '-']
  3.     if 3 <= len(username) <= 16:
  4.         for character in username:
  5.             if character.isalnum() or character in allowed_symbols:
  6.                 continue
  7.             return
  8.     else:
  9.         return
  10.     print(username)
  11.  
  12. list_usernames = input().split(', ')
  13. while len(list_usernames):
  14.     name = list_usernames[0]
  15.     valid_username(name)
  16.     list_usernames.pop(0)
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement