I’m having an issue with part of my code. I’ve created a dictionary below
names_meaning = {
"Taiwo": "First of a twin",
"Tariro": "Hope" ,
"Joseph": "God will add",
"Joel": "YHWH (or LORD) is God",
"Jude": "Praised",
"Hannah": "Favour or Grace"
}
I created a new list from the keys in the dictionary above.
family_names = list(names_meaning.keys())
Then I’m asking the user for an input and I’ve called it below.
name = input("Please type a name to know the meaning: ").capitalize()
From the user’s input, I am checking to see if it is in a family_names.
if name not in family_names:
print(f"You can only pick a name from this list of names {family_names}.")
name = input("Please type a name to know the meaning: ").capitalize()
else:
print(f"{name} means: {names_meaning[name]}\n")
The check works only once. I need the check to continue saying "Please type a name to know the meaning: " until the user types in the correct name. What am I doing wrong?