Access by Index not working

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/python-beginner-sRXwR/0/4?curriculum_id=4f89dab3d788890003000096

<In what way does your code behave incorrectly? Include ALL error messages.>
When I enter Y to define the variable named " fifth_letter " as it says to do in the hint I get the message:
“Oops, try again. Remember to use the string “MONTY” (all caps!) in your code.”
What does this mean.
<What do you expect to happen instead?>
I get to pass the level

```python

“”"
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 = “Y”

print fifth_letter

<do not remove the three backticks above>

When they tell you to access it by index they mean for you to do it in this format as shown in the instructions:

So if you wanted "Y", you could just type
"PYTHON"[1] (always start counting from 0!)

I’m sure you can figure out your mistake now. :slight_smile:

1 Like

Thank you. I got passed it>

Welcome! Glad to help! :slight_smile:

I’m still trying to work out this code. I have tried done numerous attempts to resolve this operation, however I’ve been unsuccessful. I came across your post and I still do not understand where the issue is occurring.

Can I see your code?

So complicated, yet so simple. I feel like a complete idiot!!!:flushed:

1 Like

@mystfan Don’t, I was confused myself when I first learned it. :smile:

I am stuck on this and have been for several weeks. Please can somebody help me?

Can I see your code?

I am stuck and have been for a couple of days. Could someone help me.

I would be happy to help you, but it would be best if you created a new thread.

This worked for me.

“”"
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”[4]
print fifth_letter

1 Like

It’s very complicated, but the answer is

“MONTY”[4]
0 1 2 3 4
we have 5 letters and he asks the fifth letter in (MONTY)
and remember in programming we begin with 0

I feel so stupid. It reminds you to start counting from “0” and my brain automatically says “NO! start at 1.” Stupid over thinking.

fifth_letter = "“MONTY”[4]

It takes time to sink in, don’t hate yourself for it. :slight_smile:

Arrays always throw me :confounded:

For some reason the code below is not working despite me following your instructions, please can you help.

“PYTHON”[1]
fifth_letter = “MONTY”[4]

print fifth_letter

Do you have any indents? Also, if this line:[quote=“jetpython, post:19, topic:51779”]
“PYTHON”[1]
[/quote]

Isn’t a comment, then it may be part of the problem. Not sure about that though.