Stuck on strings & console output, exercise is wrong?


Hello everyone!

So im caught in a riddle, the instructions are as follows:

"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."

I encountered the following problems:

-If i count the Python way, the string "MONTY" doesn't have a fifth letter..
-If i count the normal way, the fifth letter would be "Y" indeed, however the exercise doesn't see this as a valid expression, because off course in Python the fifth letter wouldn't exist in this exercise.

So here is the code i tried:
fifth_letter = "Y"

print fifth_letter


print fifth_letter[4]

So tell me, what am i doing wrong here :)?

With kind regards


instead of doing the counting in your print statement try doing fifth_letter = "MONTY"[4] !!!


Cheers mate ! I thought i was losing it haha.
Never would have thought to use indexing as a value in a variable itself, maybe its time to read the examples as well instead of just the instructions!

Thanks Bibleman13 !


Glad to have helped ya out! Happy coding! :smiley:


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