This is going to be a fun lesson since we are going to build a Wheel of Fortune guessing game using regular expressions and several other Ruby methods.
To start out, let's create a variable called:
starting_sentence = "Hi from matching land"
This variable is the sentence that the user is going to have to guess while playing the Wheel of Fortune game.
The next step is to convert the sentence into an array of letters and convert them all into lowercase letters. The code for this is:
sentence_array = starting_sentence.split("").map(&:downcase)
Next, we have to get the count of letters in the array minus the empty spaces; to do this, add the following code:
accurate_count = sentence_array - [" "]
This value will be useful to loop through sentence_array later.
Then, we put our regular expression through...