characters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "-", "'", " ", "*"]
def enter_first_name():
while True:
    first_name = input("Enter your first name: ").lower().rstrip().lstrip()
    for i in first_name:
        if i in characters:
            print(i)
            return first_name
        else:
            print("ERROR! Invalid entry.")
The print(i) is there to check that it's working properly but all it prints is the first letter from whatever the user inputs as their name. The purpose is so that if someone were for example to accidentally type a number in their name (any symbol not included in the list characters) that it returns "ERROR! Invalid entry." and prompts them to enter their name again.
What am I doing wrong and how can I go through each letter from the input to ensure it's a valid entry?
Thank you!


return first_namefrom the if-statement, and putting it outside of the for-loopcharactersshould be a set, for O(1) lookup, second, you are returning after the first iteration of your loop if the user has entered a valid character.