name = input("please enter your name: ") badChar = False for ch in name: if ch == ' ' or ( '0' <= ch <= '9'): badChar = True break # verify if name less than 20 charachter, start with a letter and don't contain a bad Chararccer first = name[0] isLetter = ('A' <= first <= 'Z') or ( 'a' <= first <= 'z') if(len(name) <= 20 and badChar == False and isLetter ): print("Accepted") else: print("Refused")