# SPDX-License-Identifier: MIT
# Independently authored from Python 3.9's sequence and slicing contracts.
s = "Aé😀Z"
print(s[0], s[-1], s[True], s[2])
print(s[:], s[::-1], s[1:3], s[3:0:-2], s[-99:99:2])
print(repr(s[2:1]), repr(s[:-1:-1]), repr(s[-1::-1]))
huge = 10 ** 40
print(s[-huge:huge], s[::huge], s[::-huge])
b = b"\x00\x7f\x80\xff"
print(b[0], b[-1], b[True], b[::-1], b[1:-1])
a = [10, 20, 30, 40, 50]
copy = a[::-2]
copy[0] = 99
print(a, copy, a[:], a[-100:100:2], a[4:0:-2])
print([][:], a[2:2], a[::huge], a[::-huge])
for index in [-huge, -5, 4, huge]:
    try:
        print(s[index])
    except IndexError:
        print("bounds")
try:
    print(s[::0])
except ValueError as error:
    print(type(error).__name__, str(error))
def mark(label, value):
    print(label)
    return value
print(s[mark("start", 1):mark("stop", 4):mark("step", 2)])
