I am stuck pls help! idk what im supposed to do im confused


#1



https://www.codecademy.com/courses/python-beginner-sRXwR/0/4?curriculum_id=4f89dab3d788890003000096


Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: invalid syntax (python, line 1)


Replace this line with your code. 
"""
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 fifth_letter


#2

They are asking you to print the fifth letter of the string monty and store it in a variable called fifth_letter and in python we start counting from 0 like this,

0 1 2 3 4 
M O N T Y

So to print the fifth letter of the string MONTY you would just type in,

fifth_letter = "MONTY"[4]

Which if printed would give you Y


#3

thank you so much im such a idiot lol i didnt understand what they meant but i do now thanks


#5

@chahal_jr I was confused too when I first encountered that, but what it is basically saying is that when you are counting in Python( or in any language for that matter) you always start from zero, so if we write:

"c  h  a  h  a  l"
 0  1  2  3  4  5

Then that is the counting sequence. All you have to do in the exercise is write the number the "Y" would fall in for MONTY like this:

fifth_letter = [number]

I' sure you can figure out the number now. Hope that helps! :slight_smile:

Good luck and happy coding!

-- @chipjumper36731


#6

The fifth_letter = "MONTY"[4] answer did not wok for me any other ideas?


#7

Can i please see your code :slight_smile:


#8

Did you do this exactly?

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

#9

Once I reset the code (the button to the right), the code worked.
The reset button should be mentioned somewhere so that others don’t have to
suffer the same frustrated fate.


#10

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