You are tasked with helping write part of an exciting new word-guessing game, “Durdle”. The game is one in which a player attempts to guess a five-letter word in successive guesses. In this problem and the next one, we will build an implementation of this word-guessing game. First, to support this game, we will write a function named durdle_match(guess, target) that takes in two strings - a player’s guess, and the target word that the player is attempting to guess. Each of the given words is five letters long. This function should return a five-letter string consisting of the letters B, G, and Y that has a meaning associated with the guess as follows: B: This letter in the guess does not appear in the target string Y: This letter in the guess appears in the target string in another location G: This letter in the guess appears in the same location in the target string Hints:
Please code in python
You are tasked with helping write part of an exciting new word-guessing game, “Durdle”. The game is one in which a player attempts to guess a five-letter word in successive guesses. In this problem and the next one, we will build an implementation of this word-guessing game.
First, to support this game, we will write a function named durdle_match(guess, target) that takes in two strings - a player’s guess, and the target word that the player is attempting to guess. Each of the given words is five letters long. This function should return a five-letter string consisting of the letters B, G, and Y that has a meaning associated with the guess as follows:
- B: This letter in the guess does not appear in the target string
- Y: This letter in the guess appears in the target string in another location
- G: This letter in the guess appears in the same location in the target string
Hints:
- You may assume that both of the input strings are 5 letters and all lowercase.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps