Monty Codes not working


I was on here trying to do stuff and this happened
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"[6]

print fifth_letter

but I get the error Oops, try again. Remember, the fifth letter is not "MONTY"[5]! Remember to start counting from 0. Your code threw the following IndexError: string index out of range

Please help


This might help you.

another thing to note..

IndexError: string index out of range


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

so if you try 6,which is non existent ,It will throw an error.

One interesting thing..

You can access separate pieces of string using Negative index too..

P -- > -6
Y --> -5
T --> -4
H --> -3
O --> -2
N --> -1

Notice -1 is for last letter,then it gets -2,-3 for other letters from Right to Left.


The only thing that i can see that are wrong is that you used --> "MONTY"[6] you could have just accidentally put 6 instead of 4.

fifth_letter = "MONTY"[4]

print fifth_letter

If it's not that, the problem would most likely with codecademy and how they are operating the editor


Thank you man this actually worked :slight_smile:


I believe that their use of the 'pre-written' "PYTHON" instead of "MONTY" which is in the the assignment, simply causes confusion in the assignment.

Multiple examples can be a great thing. However, NOT when we are just learning syntax and basic use cases... ONLY USE ONE EXAMPLE so that we can track what is being asked of us, and then beef up scenarios and multiple examples later.


nah the guy name thejoshua329 solved it


As did I... after laborious effort, as an effect of confusion. The point of this site is not simply to provide interactive coding tools, as simple games would. The point (as I understand it) is to provide teaching tools for coding.

Education requires clarity of communication, and an open willingness to review tools for a better overall impact.

This is not a matter of "right or wrong". This is a matter of best, most impactful, use of a site intended to inform its visitors and patrons to be productive with the use of new skills.

Through this, the site naturally raises its value profile... allowing for a higher demand to their paying members. At the end of the day, "just getting by" is a standard for models which become cautionary tales to some degree or another.


I just don't get it!!! :(


oh, it was:

because you needed to figure out the value of 'Y' and to do that, you need to count the letters
(but be careful! the first letter will be 0, then 1, 2, 3,...


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