4/16 Help. I tried everything


#1

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 = "Y"[5]***

***print fifth_letter***

I tried everything but I cant do this right


#2

fifth_letter="MONTY"[4]

START COUNTING FROM 0


#4

Alright, I'm stuck on this too and I understand what it's trying to say, but telling someone to start counting from zero and then asking him/her to find the fifth letter makes absolutely no sense. Regarding that rule, MONTY only has four letters and that is where most people are confused.


#5

Well, in language arts and stuff, there are 5 letters in MONTY. Codecademy is just saying to find the fifth letter in MONTY, trying to fool you and making you put 5 instead of 4, which they shouldn't have done, if they read the thing. :smiley:

Or something like that.:smiley:


#6

So, is there no answer to this question? MONTY only has 5 letters, but you start counting with zero????!!!!! NO SENSE! I don't get this!


#7

In coding, you start with 0.

M O N T Y
0 1 2 3 4

That's how coding goes.:smile:


#8

Yes, but they output should be 4? So should I just put "Y" in the space?


#9

So the output should be "Y", yes. And you should put 4 in the space. A difference there. :wink:


#10

The letter counts from 1 to 6, so the word has 6 letters. But the python stores the string with start index as zero.
so the count of python starts from 0. so the fifth letter is if we count from 1 is o, which is indexed at "PYTHON"[4] which prints the fifth letter O.I hope this is clear


#11

So, it would be Mont4y?


#12

Hey, can you show me your code first? That would make me be able to correct it faster.


#13

MONTY = "Y"[0]
fifth_letter = "MONTY"[4]

print fifth_letter


#14

It was the big long comment that messed me up. All you have to do is put. "MONTY" [4]