I need to replace certain letters in a word with a character.
I'm stuck. How can I fix it?
It looks like you already have most of the code. You just need to add the letters that don't need to be replaced and are not in the consonants
list.
To do this, I would use an if-else
instead of an if
in your loop. This will allow you to replace letters that are in the consonants
list and add letters that don't need to be replaced to the final word
.
It would look something like this:
Note that the consonants
list has the characters that are to be replaced in word word
.
This should give you what you are looking for.