My issue
what is “have you forgot to greet?”
My code
import time
import random
def choose_word():
words = ['codechef', 'programming', 'learning', 'practice', 'contests', 'rating']
return random.choice(words)
def wordDisplay(word, guesses):
display_word = ''
# Solution as follows
for char in word:
if char in guesses:
display_word += char + ' '
else:
display_word += '_ '
return display_word
if __name__ == '__main__':
word = choose_word()
#print("Word selected for this round is '" + word + "'") -- You can uncomment this line to test your code
guesses = ''
while True:
print(wordDisplay(word, guesses))
guess = input("\nguess a character: ").lower()
guesses += guess
Learning course: Build Projects using Python
Problem Link: Project - Hangman Practice Problem in Build Projects using Python - CodeChef