Write a "bouncer" program that uses a list to decide if people get in to a party or not.
$ python bouncer.py
What's your name? jeff
You're on the list...welcome to the party.
$ python bouncer.py
What's your name? valerie
Sorry, you're not on the list.
For this, you could use the in operator, or an accumulator, or what's
called a boolean flag. Assume you have two variables: a list of allowed
guest names (guestlist), and the name of a possible guest (name):
# assume they are not on the list
FOUNDNAME = False
# now check for name in guestlist, one at a time
for guest in guestlist:
if name == guest:
FOUNDNAME = True
# at this point, the boolean flag tells if they are on the list or not
if FOUNDNAME:
print("You're in...")
else:
print("Sorry...")
Mention pudb file.py here are show an example?
Mention from math import * here vs import math??