What is wrong in this code?


On line 13, assign the variable fifth_letter equal to the fifth letter of the string "MONTY".

Remember that the fifth letter is not at index 5. Start counting your indices from zero.

Code :
The string "PYTHON" has six characters,
numbered 0 to 5, as shown below:

| P | Y | T | H | O | N |
0 1 2 3 4 5

So if you wanted "Y", you could just type
"PYTHON"[1] (always start counting from 0!)
fifth_letter = "MONTY"

print fifth_letter


They gave you an example of how to get the "Y" in "PYTHON". Which is "PYTHON"[1] as you can see that indices start at 0.

So....you do something similar to get the "Y" in "MONTY". As in

fifth_letter = "MONTY"[n] #replace n with the index that Y is in


That is because it tells you that the answer is Y


DIdnt still work. Used fifth_letter = "MONTY"[4}


Start counting indices from zero. The Y is at the index 4.

print fifth_letter[index]

Replace index with the number at which you've Y :slight_smile:


Hi, replace the closing } with ]


This is a bug I'm sure Y is the 4th number when zero is included
Im guessing whoever wrote this programs in another language and forgot the python logic


I was stuck with this one too! Wasn't paying attention to the fact that your result is supposed to say "Y".

0 1 2 3 4
fifth_letter = "MONTY"[4]

Thank you, guys! :slight_smile:


Issue has been resolved. Thank you for all the feedback


It keeps telling me that the fifth letter is not "MONTY"[5] even thought I have it set to "MONTY"[4] What am I doing wrong?


Did you store it in the variable they gave you called fifth_letter?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.