title: Hangman game changing word throughout game
body: <p>While I am creating the word_blank_list (the list with blanks for the user) for choose_word, the word is changed and not recognized since it is a new word when I try to remove it from the list. The code and error message is below. The rest of the code works. This is the last step. Thank you!</p>
  <pre><code>#Choose a word
  import urllib.request
  import random
  
  def choose_word():
    word_file = 'https://raw.githubusercontent.com/lizzierobinson2/coolcode/master/list%20of%20words'
    my_file = urllib.request.urlopen(word_file)
    chosen_word = my_file.read()
    chosen_word = chosen_word.decode(&quot;utf-8&quot;)
    list_of_words = chosen_word.split(&quot;\n&quot;)
    for x in range(1):
      return random.choice(list_of_words)
      break
    
  print('Welcome to the game hangman! The blanks of a word I have chosen are printed below. :)')
  
    #Create a list that holds the word and makes each letter a string
  word_blank_list = [choose_word()]
  length = len(choose_word())
  
  for spaces in range(length):
    word_blank_list.append('_')
  
  #word_blank_list.remove(choose_word())
  print(word_blank_list)
  
  word_list = [choose_word()]
  string = ''
  string = string.join(word_list)
  
  word_string = list(string)
  
    #Define print_body and say what happens when the letter is not in the word
  def print_body(number):
    if number == 1:
      print(&quot;  \|/  &quot;)
    if number == 2:
      print(&quot;  \|/  &quot;)
      print(&quot;  (_)  &quot;)
    if number == 3:
      print(&quot;  \|/  &quot;)
      print(&quot;  (_)  &quot;)
      print(&quot;   |   &quot;)
      print(&quot;   |   &quot;)
    if number == 4:
      print(&quot;  \|/  &quot;)
      print(&quot;  (_)  &quot;)
      print(&quot;  /|   &quot;)
      print(&quot; / |   &quot;)
    if number == 5:
      print(&quot;  \|/  &quot;)
      print(&quot;  (_)  &quot;)
      print(&quot;  /|\  &quot;)
      print(&quot; / | \ &quot;)
    if number == 6:
      print(&quot;  \|/  &quot;)
      print(&quot;  (_)  &quot;)
      print(&quot;  /|\  &quot;)
      print(&quot; / | \ &quot;)
      print(&quot;  /    &quot;)
      print(&quot; /     &quot;)
    if number == 7:
      print(&quot;  \|/  &quot;)
      print(&quot;  (_)  &quot;)
      print(&quot;  /|\  &quot;)
      print(&quot; / | \ &quot;)
      print(&quot;  / \  &quot;)
      print(&quot; /   \ &quot;)
  
  num_of_tries = 0
  
  while True:
    ask_guess = None
    #Ask the user for a letter
    letter_ask = input('Enter a letter. ').lower()
    #printing 2 of same letter
    placement = []
    guess = letter_ask
    for x in range(len(word_string)):
      if word_string[x] == guess:
        placement.append(x)
    for x in placement:
      word_blank_list[x] = guess    
  
    if letter_ask not in word_string:
      num_of_tries = num_of_tries + 1
      print('This letter is not in the word. A part of the body has been drawn. Try again.')
      print_body(num_of_tries)
         
      #What happens when the letter is in the word
    if letter_ask in word_string:
      location = word_string.index(letter_ask)
      word_blank_list[location] = letter_ask
      print(word_blank_list)
      ask_guess = input('Would you like to guess what the word is? ').lower()
      
      if ask_guess == 'yes':
        guess = input('Enter your guess. ').lower()   
           
      if ask_guess == 'no':
        continue
  
      #How to stop the game
    if num_of_tries == 7:
      print('You lose :(')
      break
    if guess == choose_word():
      print('Congrats! You win!')
      break 
    if guess != choose_word() and ask_guess == 'yes':
      print('This is incorrect.')
      continue 
  </code></pre>
  <pre><code>ValueError                                Traceback (most recent call last)
  &lt;ipython-input-42-0f2af26177a0&gt; in &lt;module&gt;()
       22   word_blank_list.append('_')
       23 
  ---&gt; 24 word_blank_list.remove(choose_word())
       25 print(word_blank_list)
       26 
  
  ValueError: list.remove(x): x not in list
  </code></pre>
  <p>Thank you so much!</p>