Oct-31-2022, 10:15 PM
Hello, I’ve recently started to learn about Python (for about 2 months), and I need some help to create a word based game, similar to a game called “Wordle”, I was able to do most of the coding, but I'm having trouble creating the hints part, for that I'm supposed to do the following:
Letters that are not present at all in the secret word show a "underscore _".
Letters that are present in the secret word, but in a different spot show in 'lowercase".
Letters that are present in the secret word at that exact spot, show in "uppercase".
Until now my code looks like this:
If someone can help me with this, I will be grateful !
Letters that are not present at all in the secret word show a "underscore _".
Letters that are present in the secret word, but in a different spot show in 'lowercase".
Letters that are present in the secret word at that exact spot, show in "uppercase".
Until now my code looks like this:
import random random_words = ("house" "sound", "television", "family", "microwave", "water") secret_word = random.choice(random_words) guess = "" guess_count = 0 hint = "_ " * len(secret_word) print("Welcome to the guessing game !") print() while guess != secret_word: print(f"Your hint is {hint}") guess = input("What is your guess? ").lower() if len(guess) != len(secret_word): print("Please enter the right lenght!") guess_count = guess_count + 1 else: print("Congratulations You guessed it!") print() print(f"It took you {guess_count} guesses to get it right!")What I need to do looks something like this:
If someone can help me with this, I will be grateful !