char in python

>>> s = "python"
>>> s[3]
'h'
>>> s[6]
Traceback (most recent call last):
  File "", line 1, in 
IndexError: string index out of range
>>> s[0]
'p'
>>> s[-1]
'n'
>>> s[-6]
'p'
>>> s[-7]
Traceback (most recent call last):
  File "", line 1, in 
IndexError: string index out of range
>>> 

Here is what the above code is Doing:
1. We created a string variable s and assigned it the value “python”.
2. We printed the character at index 3 of the string s.
3. We tried to print the character at index 6 of the string s. This caused an error because the index of the last character in the string s is 5.
4. We printed the character at index 0 of the string s.
5. We printed the character at index -1 of the string s.
6. We printed the character at index -6 of the string s.
7. We tried to print the character at index -7 of the string s. This caused an error because the index of the first character in the string s is 0.