Help with assigning variable to MONTY


Replace this line with your code.


@superrunner1993, where is your code?


Access by Index
The lesson states: "Each character in a string is assigned a number. This number is called the index."
" we create a new variable called c and set it to "c", the character at index zero of the string "cats"."
"we create a new variable called n and set it to "n", the character at index three of the string "Ryan"."
"In Python, we start counting the index from zero instead of one."
Why does the hint say I need to type "Y" when it asks me to assign the fifth letter from MONTY? According to the lesson (above), MONTY would be indexed as 0,1,2,3,4. There is no fifth index in MONTY.

****Okay, after typing this and re-reading it along with the instructions in the lesson, I now know why myself along with others that have posted are confused on this one. Why would the instructions ask us to assign the fifth "letter" when the lesson itself was on "Index"?? The question would have made more sense if it would have pertained to asking for the the fourth "index" instead of the fifth "letter". Y is the fifth letter in MONTY but it is the fourth index.


fifth_letter = "MONTY"[4]
print fifth_letter


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