lementation 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 word
Problem C. Durdle Match
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
Examples:
>>> durdle_match('quick','perky')
'BBBBY'
>>> durdle_match('favor','perky')
'BBBBY'
>>> durdle_match('threw','perky')
'BBGYB'
>>> durdle_match('parry','perky')
'GBGYG'
>>> durdle_match('perky','perky')
'GGGGG'
Hints:
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images