input: Write a function to simulate a hangman game where the player guesses letters to complete a word.
  assert type(hangman('cat')) == str
  assert 'You won!' in hangman('mouse') or 'You lost!' in hangman('mouse')
  assert 'You won!' in hangman('lion') or 'You lost!' in hangman('lion')
  assert 'You won!' in hangman('dog') or 'You lost!' in hangman('dog')
output: def hangman(word):
      guessed_word = ['_'] * len(word)
      guessed_letters = set()
      attempts_left = 6
  
      while attempts_left > 0 and '_' in guessed_word:
          print('Current word: ' + ' '.join(guessed_word))
          guess = input('Guess a letter: ').lower()
  
          if guess in guessed_letters:
              print("You've already guessed that letter.")
              continue
  
          guessed_letters.add(guess)
  
          if guess in word:
              for i, letter in enumerate(word):
                  if letter == guess:
                      guessed_word[i] = guess
          else:
              attempts_left -= 1
              print(f'Incorrect guess. Attempts remaining: {attempts_left}')
  
          if '_' not in guessed_word:
              return 'You won! The word was ' + word
  
      return 'You lost! The word was ' + word