Please Help


#1

Honestly, have no clue what I'm doing wrong here, can someone tell me what to put and explain why? I've tried for over an hour and can't get my head around it. saw other posts on this but they didn't say what was needed to be input or why, they just said to read the instructions basically

Thanks - Code I used bellow

fifth_letter = "MONTY"[5]

print fifth_letter

(tried many different ways)

as the screenshot isn't posting, here is a link to the activity

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


Monty Codes not working
#2

lets check Example given in the exercise itself..

+---+---+---+---+---+---+
| P | Y | T | H | O | N |
+---+---+---+---+---+---+

String have 0-indexing.

what does it mean?
You can see word ("PYTHON") above and think like this...

Oh, P is on 1st place
Y is on 2nd place and so on....
but Python does not think same way...

Python starts counting from 0.
It thinks like this..
Oh, P is on 0th position
Y is on 1st position and so on,,,

Now in this exercise you have asked to print 5th letter
and you think if you do this "MONTY"[5] then it will give 5th letter but
now think like python ?
what is 5th letter for Python.. 4 or 5?


#3

Thank you so much! You explained that so much better than the exercise, I just got confused about how they worded it. Thanks again


#4

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