Using the function from the previous problem, write a function durdle_game(target) which takes in as an argument a single string that will be the target to guess, and lets the user attempt to guess the target word. Each time the user makes a guess, the function will print out the result of the previous function to tell the user how close they are. If the user guesses correctly, then the game is over. Have the function return the number of guesses that it took the user to get the correct answer

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

Please code in python

Using the function from the previous problem, write a function durdle_game(target) which takes in as an argument a single string that will be the target to guess, and lets the user attempt to guess the target word. Each time the user makes a guess, the function will print out the result of the previous function to tell the user how close they are. If the user guesses correctly, then the game is over. Have the function return the number of guesses that it took the user to get the correct answer

Hints:

  • You may assume that the target and all of the input strings are 5 letters and all lowercase.
>>> durdle_game ('trick')
Welcome to Durdle!
Enter a guess:touch
GBBGB
Enter a guess:trash
GGBBB
Enter a guess:truck
GGBGG
Enter a guess:trick
GGGGG
Congratulations, you got it in 4 guesses!
4
Transcribed Image Text:>>> durdle_game ('trick') Welcome to Durdle! Enter a guess:touch GBBGB Enter a guess:trash GGBBB Enter a guess:truck GGBGG Enter a guess:trick GGGGG Congratulations, you got it in 4 guesses! 4
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
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:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning