All pastes #173889 Raw Edit

Leeds

public python v1 · immutable
·published 2006-09-17 10:25 UTC
rendered paste body
#! /usr/bin/env pythonimport randomimport sysmen=["""         ""","""=========""","""||||||=========""","""|||||\\| \\=========""","""/-----\\|||||\\| \\=========""","""/-----\\| /|/|||\\| \\=========""","""/-----\\| /   ||/    o|    /|\\|     ||\\   / \\| \\=========""","""/-----\\| /   ||/    ||     ||     ||\\    o| \\  /|\\===   |   | / \\   |   |   |"""]f=open("/usr/share/dict/words","r")words=[i.strip() for i in f if len(i)>5]word=list(random.choice(words))pos=0outword=["_"]*len(word)print "".join(outword)lets=[]while pos<len(men)-1:  let=""  while len(let)!=1 or let in lets:    let=raw_input("Enter letter: ").strip()  lets.append(let)  if let in word:    for i in range(len(word)):      if word[i]==let:        outword[i]=let  else:    pos+=1  if outword==word:    print "You won! :-)"    print "The word was %s"%"".join(word)    sys.exit(0)  print  print men[pos]  print  print "["+"".join(lets)+"]"  print "".join(outword)print "LOSER!"print "The word was %s"%"".join(word)