Может кто-нибудь помочь мне сделать игру в палач. (Python) - PullRequest
0 голосов
/ 02 мая 2020

def getResult (status): if (status == word): Result = "Вы выиграли" return Result else: Result = "Вы проиграли" return Result def updateStatus (word, x, status):

if(word.count(x) == 0):
    new_status = status
    return new_status

elif (word.count(x) > 0):
    find_index = word.find(x)
    indexes = []
    while find_index != -1:
        indexes.append(find_index)
        find_index = word.find(x, find_index + 1)
        for i in range(len(indexes)):
            status = status[:indexes[i]] + x + status[indexes[i] + 1:]
            new_status = status
    return new_status

def startGame (word): status = "" new_status = ""

count = len(word)

for i in range(count):
    status = status + "_"

while count > 0:
    x = input("%s chances, Enter a letter :" % count)
    updateStatus(word, x, status)
    count = count - 1
    print(updateStatus(word, x, status))
    if (count == 0) or (status == word):
        return getResult(status)

Я хочу сделать _____ -> H____ -> HE___ -> HELL_, но результат будет _____ -> H____ - > _____...

Не могли бы вы найти, что с ним не так? введите описание изображения здесь

введите описание изображения здесь введите описание изображения здесь

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...