def main(): end_program = False while not end_program: print("\n** Select App to Run **\n") selection = displayMenu(menu_items) if selection == 1: MissingNumber.missing_number() elif selection == 2: RomeToNum.roman_to_int() elif selection == 3: SubArraySum.find_sub_array() elif selection == 4: Anagram.anagram() else: end_program = True
def main(): DICTIONARY = "english.txt" # Get the input word or phrase inputstring = raw_input("Please enter a word or phrase for which to find anagrams: ") # Check to see if the user wants to use advanced features. advanced_options = raw_input( "Would you like to enter advanced options for the anagram finder? Enter true or false: " ) if advanced_options.lower() == "true": # If so, ask for lists of the includes and excludes, and a number for max words. include_words = raw_input( "Please enter a list of comma-separated words that must be in the anagram (Hit enter to ignore): " ) exclude_words = raw_input( "Please enter a list of comma-separated words that must NOT be in the anagram (Hit enter to ignore): " ) maximum_length = raw_input("Please enter a maximum number of words for each anagram (Hit enter to ignore): ") # Since I want the user to be able to hit enter for ignoring the options, I use raw input, # which I must try to cast to an int in the try/except block below try: maxlength = int(maximum_length) except: maxlength = 0 # Add the inputs to the Anagram class a = Anagram( inputstring, DICTIONARY, filter(None, include_words.split(", ")), filter(None, exclude_words.split(", ")), maxlength, ) # If the user just wanted basic functions, do so else: a = Anagram(inputstring, DICTIONARY) # Go crazy generating anagrams a.findAnagrams()
def action(): Anagram.action()
import Anagram print(Anagram.anagram_solution('abcd', 'bcda'))