python - Prevent input() from being anything but alphabet characters -
i attempting make program sake of self-knowledge. want ask user name is, , want user able use letters alphabet answer, or strings. not want them able answer numbers, symbols, etc. def cc(): name = (input("""hello, happens first name? > """)) if type(name) str: print("you have entered name correctly.") elif type(name) int: print("your name cannot integer. try again.") cc() cc() you can enforce requirement using str.isalpha . documentation: return true if characters in string alphabetic , there @ least 1 character, false otherwise . alphabetic characters characters defined in unicode character database “letter”, i.e., general category property being 1 of “lm”, “lt”, “lu”, “ll”, or “lo”. note different “alphabetic” property defined in unicode standard. here example program: while true: name = input('enter name using alphabetic characters: ') if name.isalpha(): ...