Slice to Position in Python

To get a cut to any position, you need to specify only the ending index to the right of the colon. Let's output all the characters of the string up to the third index:

pythontxt = 'abcde'
res = txt[:3]

print(res) # 'abc'
Задание 1

Given a string:

pythontxt = '12345'

Get a slice of all its characters except the last one:

python'1234'
Задание 2

Given a list:

pythonlst = ['a', 'b', 'c', 'd', 'e']

Write the code to get the following slice:

python['a', 'b']