Why Oops, try again. Remember to use the string "MONTY" (all caps!) in your code


#1

why Oops, try again. Remember to use the string "MONTY" (all caps!) in your code.

what is wrong ?

Please Help


#2

Can you put your code here.(surround the beginning and the end of your code with three backquotes each when you paste it here)

Are you using the variable "MONTY" where you have been asked to?


#3

Here's what I got. And it worked.

"""
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


#4

Great hack but it doesn't make sense though, in context to the lesson?


#5

Y = "MONTY"[4] it was weird


#6

I have the same problem too.
Totally Stucked


#8

it does not fit/there is no fifth letter is MONTY


#9

the fifth letter is Y but in python its actually number 4 because you start your count from 0 so typing you answer as "MONTY"[4] will give you the correct answer


#10

Index counting starts from 0 instead of 1. So the actual string character count at fifth postion is O. Python actually stores the string from zero, so to print fifth letter, "MONTY[4]" shall print the fifth letter


#11

Thanks, this was helpful


#12

Tks a lot, bro. Really helpful.


#13

nothing works. instrutions don't make any sense.

"""
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 = ''
print "MONTY[4]

y = "MONT"


#14

Ah, thank you. That saved me a lot of confusion as well. I thought we had to find the fifth letter by starting with the M as "zero," not simply choosing the fifth letter and then counting in Python. I think a lot of us over-complicated that.


#15

The instructions were extremely confusing, I agree. I was ready to defenestrate my computer and replace it with an abacuse.

You won't need to define y as a string. You want Python to figure it out itself (so we can be lazy in the future and have it calculate for us, yay technology). This is what you want:

fifth_letter = "PYTHON"[1]
fifth_letter = "MONTY"[4]
print fifth_letter

In other words, you're asking "What is the letter in position 1 in the word Python that is also in the fourth position of the word Monty?"