Cloud Stack Ninja

The user needs first enter a coice A,B or C and # to exit. If he enters anything else he gets prompted the same alternatives again A,B or C. Then he enters a word which is to be used to find anagrams, paligrames and palidromes. I am just starting with coding and I have no idea how to write this code and define everything.

def load(file):
    """Open a text file & turn contents into a list of lowercase strings."""
    try:
        with open(file) as in_file:
            loaded_txt = in_file.read().strip().split('\n')
            loaded_txt = [x.lower() for x in loaded_txt]
            return loaded_txt
    except IOError as e:
        print("{}\nError opening {}. Terminating program.".format(e, file),
              file=sys.stderr)
        sys.exit(1)

def find_anagrams(word_for_search, search_list_dictionary):

def find_palingrams(dictionary_list):

def print_generic_list(list_items_category_name, list_to_print):

def find_palindromes(anagram_list):

def print_pairs_of_twos(dictionary_of_pairs):

def write_anagrams_palindromes_to_file(original_word, anagrams_list, palindromes_list):

def write_palingrams_to_file(palingram_list):

def main():
    running = True


Read more here: https://stackoverflow.com/questions/64401635/finds-the-anagrams-for-any-word-you-enter-finds-all-the-word-pairs-in-the-dicti

Content Attribution

This content was originally published by Marko Veselinovic at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: