def getWord(prompt): goodInput = False while not goodInput: word = raw_input(prompt) checkQuit(word) if word.lower() == "pylon" or word.lower() == "pylons": print "You must construct addtional pylons!" print screens.showPylons( ) # Maybe this could be a function by itself; so you wouldn't have to duplicate this code so many times. sys.exit() if not isSwear(word): goodInput = True else: print "Watch your language!" return word
def getDay(prompt): goodInput = False while not goodInput: word = raw_input(prompt) checkQuit(word) days = [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday" ] if word.lower() == "pylon" or word.lower() == "pylons": print "You must construct addtional pylons!" print screens.showPylons() sys.exit() goodInput = True if word.lower() not in days: print "Not a day" goodInput = False return word
def getZooAnimal(prompt): goodInput = False while not goodInput: word = raw_input(prompt) checkQuit(word) zooAnimals = [ "zebras", "lions", "tigers", "rhinos", "bears", "monkeys", "elephants", "seals" ] if word.lower() == "pylon" or word.lower() == "pylons": print "You must construct addtional pylons!" print screens.showPylons() sys.exit() goodInput = True if word.lower() not in zooAnimals: print "Not found in a zoo" goodInput = False return word
def getTown(prompt): goodInput = False while not goodInput: word = raw_input(prompt) checkQuit(word) Towns = [ "warner", "sutton", "new london", "wilmot", "springfield", "newbury", "bradford" ] if word.lower() == "pylon" or word.lower() == "pylons": print "You must construct addtional pylons!" print screens.showPylons() sys.exit() goodInput = True if word.lower() not in Towns: print "Not a town in Kearsarge" goodInput = False return word
def getPet(prompt): goodInput = False while not goodInput: word = raw_input(prompt) checkQuit(word) PetTypes = [ "dog", "cat", "fish", "bird", "hamster", "gerbil", "snake", "lizard" ] if word.lower() == "pylon" or word.lower() == "pylons": print "You must construct addtional pylons!" print screens.showPylons() sys.exit() goodInput = True if word.lower() not in PetTypes: print "Not a pet" goodInput = False return word
def getHousePart(prompt): goodInput = False while not goodInput: word = raw_input(prompt) checkQuit(word) PartTypes = [ "door", "wall", "window", "ceiling", "door frame", "head beam", "walls", "roof" ] if word.lower() == "pylon" or word.lower() == "pylons": print "You must construct addtional pylons!" print screens.showPylons() sys.exit() goodInput = True if word.lower() not in PartTypes: print "Not a part of a house" goodInput = False return word