e a class called Word with the fields word (string) and guessed (list of guessed letters). ● include an __init__ method to initialize the field values ● include a __str__ method that returns a string representation of the word where letters that have not yet been guessed (are not in the guessed list) are replaced with underscores. ● include a method called addLetter() that takes a letter as a parameter and adds it to the guessed list. ● include a method called guessLetter() that takes a letter as a parameter and checks if that letter is in the word. The method should return true if the letter is in the word and false otherwise. ● include a method called win() that c
USING PYTHON
Create a class called Word with the fields word (string) and guessed (list of guessed letters).
● include an __init__ method to initialize the field values
● include a __str__ method that returns a string representation of the word where letters that have not yet been guessed (are not in the guessed list) are replaced with underscores.
● include a method called addLetter() that takes a letter as a parameter and adds it to the guessed list.
● include a method called guessLetter() that takes a letter as a parameter and checks if that letter is in the word. The method should return true if the letter is in the word and false otherwise.
● include a method called win() that checks if all the letters in the word are in the guessed list (i.e., all the letters have been guessed)
Step by step
Solved in 4 steps with 2 images