# HElp me with this example

#1

"""
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[4]

#2

What error is it giving you?

#3

Oops, try again. The value of fifth_letter is "MONTY" instead of "Y".

#4

i don,t know what to do

#5

The way your code is written you are assigning fifth_letter the value of "MONTY" meaning that when you print fifth_letter it will output "MONTY". What the exercise is asking for is that you set fifth_letter equal to the fifth letter of "MONTY". So if you were to print fifth_letter it would output "Y".

#6

i don,t know what you mean

#7

can you explan more to me

#8

Sure. So if we go back to the example with PYTHON. If I have `second_letter = "PYTHON"[1]print second_letter`
It will print out "Y" because second_letter is set to equal not "PYTHON", but instead the second letter, "Y".

Currently, you have fifth_letter equal to "MONTY" so if I ran `print fifth_letter` it wouldn't output Y, it would output "MONTY".

Now you are running `print fifth_letter[4]` which makes the output "Y", but the value of fifth_letter is still equal to "MONTY" when it should be equal to the fifth letter of "MONTY" which is "Y".

#9

thanks i solve the problem

#10

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