Hangman wordgame golf Inspired by reddit.

Write a program which plays Hangman. 


The program chooses a random word from a list of N words, where N > 2.
The word list can be provided to the program in any way you choose.
At each iteration 


Print out the state of the game using underscores for letters not yet discovered:


H _ N _ _ _ N


Print the number of remaining attempts


10


Read a letter from stdin, and update the state of the game, subtracting an attempt if they guess an incorrect letter.


A (input)

H A N _ _ A N

10


Repeat until all letters are guessed or attempts reaches 0

Use any language
Fewest number of characters wins.
Drawing the gallows is not necessary, but will earn you upvotes and kudos.
Python 3.

from random,sys import *
w=choice(*argv)
L=set(w)
a=10
while L and a:
 print(" ".join("_"if x in L else x for x in w),a)
 try:L-=set(input()[0])
 except:a-=1


I prefer this one though: longer but nicer.

import random
w=random.choice(list(open("/usr/dict/words")))[:-1]
L=set(w)
a=10
while L and a:
 print(" ".join("_"if x in L else x for x in w),a)
 try:L.remove(input()[0])
 except:a-=1
print w