Oct-21-2021, 07:46 PM
If you would like to check against a list of names:
#! /usr/bin/env python3.9 names = ['john', 'mary', 'bob', 'sue'] while True: name = input('What is the name: ').lower() if name not in names: print('That name is not in the list.') continue else: print('That name is in the list.') break
Output:What is the name: charlie
That name is not in the list.
What is the name: bob
That name is in the list.
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags