, #!/usr/bin/python , from guess_word_functions import * , var1 = display_word() , print(var1) , var2 = , var3 = , C2 = _ , #if var1.find(var2): , # print(true) , , # initialize var3 with blanks , x = len(var1) -1 , while x > 0: , var3.append( _ ) , x -= 1 , , , while var3.count( _ ) > 0: , var2 = input(enter a letter: ) , for x in range(len(var1)): , #print(var1x) , if var1x == var2: , var3x = var2 , print(var3) , ,
, , , # return random word from dictionary , def get_word(word_len): , import random , filtered_words = , filtered_word = , sub_str_1 = \ , sub_str_2 = é , , with open(/usr/share/dict/american-english, r) as file: , words = file.readlines() , , for x in range(len(words)): , if len(wordsx) == word_len and not sub_str_1 in wordsx and not sub_str_2 in wordsx : , filtered_words.append(wordsx) , , #for x in range(len(filtered_words)): , filtered_word = random.choice(filtered_words) , return filtered_word.lower() , , #print(get_word(5)) , def get_word_length(): , # get user input for length of word , , word_len = input(DQEnter the length of word, up to 23, that will be randomly provided: DQ) or 2 , , # check if input is a number , while not word_len.isdigit(): , word_len = input(word_len + is not a whole number. Please enter a whole number, no decimels:) , , while int(word_len) > 23 : , word_len = input(word_len + is too large. Please enter a number 23 or less:) , return int(word_len) + 1 , , def display_word(): , word = get_word(get_word_length()) , , return word ,