not_com_word
パーツが推測された文字を一緒に印刷しない理由がわかりません。推測関数の各ループで、not_com_word
は未完成の単語を表し、推測された文字と左の隠し文字を一緒に表示する必要があります。
# Country Guess game produced by Farzad YZ
import random
import string
print '**Guessing game [Country version]---Powered by Farzad YZ**'
seq = ['iran','iraq','england','germany','france','usa','uruguay','pakistan']
choice = random.choice(seq)
length = len(choice)
print 'The hidden word is:',length*'*'
def guess():
while 1:
not_com_word = ''
i = raw_input('Guess the character in turn: ')
if i == choice[g]:
print 'That is right!'
not_com_word = not_com_word + i
print 'Guessed till here ->',not_com_word,((length-g-1)*'*')
break
else:
print 'Wrong! Try again.'
continue
g = 0
while g < length:
guess()
if g == length-1:
print '''Congratulations! You guessed the country finally.
The country was %s.''' %choice
g = g+1