I tried quit(0) and sys.exit too
import random
word = random.choice(open(r"C:\Users\Sigma.jota3\Documents\new.txt").read().split()).strip()
word = list(word)
print ' '.join(word)
word_2 = []
for i in range(len(word)):
word_2.append("_")
print ' '.join(word_2)
word_3 = []
count = 0
numbers_to_count = len(word)
while True:
word_input = raw_input("")
word = ''.join(word)
for el in range(len(word)):
if not word[el] != word_input:
word_3.append(word[el])
numbers_to_count = numbers_to_count - 1
print "your answer is right!, now you have %s letters to resolve!" % numbers_to_count
if numbers_to_count == 0:
print "Congratulations, you win!"
exit(0)
if numbers_to_count < 0:
exit(0)
for le in range(len(word)):
word_word_input = word.find(word_input)
if word_word_input < 0:
count = count + 1
print "Try again, you have failed in %s times!" % count
if count > 7:
print "Tip: The word have %s letters." % len(word)
if count > 12:
print "You lose!, you made more than %s tries." % count
exit(0)
exitis not a global function; it's defined in thesysmodule. So, you'd needimport sysat the top of the script, andsys.exit(0)to actually exit. Or alternatively,from sys import exitat the top, and leave theexit(0)s alone.