I need help with this?


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


The fifth letter in the above diagram for PYTHON is, 'O'. Now look at the index below the 'O'. Use that index on 'MONTY.'.


fifth_letter = "MONTY"[4]

print fifth_letter

Not sure if you've figured it out yet- but just in case you haven't, you have to add a [4] after "MONTY".
Have a great day!


Thanks, for your help. But still I am unable to understand why should we use the [4] after the "MONTY" ?


Because of string indexing in python starting counts at 0 so if I had a string let's say,

0 1 2 3 4

assuming it is already stored in a variable for example greeting = "HELLO" , to access the last letter I would type,

greeting = "HELLO"[4]
print greeting

the code above would return only the O in HELLO. :slight_smile: