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:

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 2RQ
icon
Related questions
Question

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.
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'
Transcribed Image Text: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'
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT