So I am making my own MadLibs game, and have come across a problem. When a user is requested to enter a noun, for example, but instead enters a verb or adverb etc. I want my program to pick up on this, and ask them to enter a different word as this word does not match criteria. How do I do this? This is what I have so far:
while True:
name1 = input("A male name (protagonist): ")
if name1.endswith (('ly', 's')):
print("Sorry mate, this doesn't seem to be a proper noun. Try it again.")
continue
break
But I would like it to come out along the lines of this:
A male name (protagonist): sandwich
Sorry mate, this doesn't seem to be a proper noun. Try it again.
A male name (protagonist): Bob
How do I make it recognise nouns, adverbs etc. without me manually typing it in?