String characters in Python

We can access any character in a string using its index (sequence number), enclosed in square brackets:

pythontxt = 'abcde'
print(txt[1]) # 'b'

Note that character numbering starts at zero.

You can also find a character from the end of the line. To do this, write its number with a minus sign. In this case, the last character will start with index -1:

pythontxt = 'abcde'
print(txt[-1]) # 'e'
Задание 1

Given a string:

pythontxt = 'abcdef'

Print the first character of this string to the console.

Задание 2

Given a string:

pythontxt = 'abcdef'

Print the second character of this string to the console.

Задание 3

Given a string:

pythontxt = 'abcdef'

Print the last character of this line to the console.

Задание 4

Given a string:

pythontxt = 'abcdef'

Print the second to last character of this line to the console.